在mainwindow.h声明全局变量extern QString account,并在mainwindow.cpp中定义它。随后在另一个类dropwindow.cpp中添加mainwindow.h,想要使用account。但出现undefined reference to 'account'和collect2.exe:ld returned 1 exit status
我写了一下,没有问题啊你的全局变量是不是定义到类里了?