我尝试从另一个线程发出信号。我的汇编说下一个错误
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -headerpad_max_install_names -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.7 -Wl,-rpath,/Users/Gleb/Qt/5.5/clang_64/lib -o checkAll.app/Contents/MacOS/checkAll main.o mainwindow.o utilits.o loopthread.o moc_mainwindow.o -F/Users/Gleb/Qt/5.5/clang_64/lib -framework QtWidgets -framework QtGui -framework QtCore -framework DiskArbitration -framework IOKit -framework OpenGL -framework AGL
Undefined symbols for architecture x86_64:
"loopThread::getResultListSignal(int)", referenced from:
loopThread::run() in loopthread.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [checkAll.app/Contents/MacOS/checkAll] Error 1
20:48:47: Процесс «/usr/bin/make» завершился с кодом 2.
Ошибка при сборке/установке проекта checkAll (комплект: Desktop Qt 5.5.1 clang 64bit)
关于这一切:
#include <QThread>
#include <QtCore>
class loopThread : public QThread
{
....
protected:
void run();
....
signals:
void getResultListSignal(int);
};
void loopThread::run()
{
....
emit getResultListSignal(m_FirstDirFilesPath.size() * m_SecondDirFilesPath.size());
....
}
但如果我评论了这个字符串,那么所有程序都正常工作
答案 0 :(得分:1)
你要么在loopThread中缺少Q_OBJECT宏,要么你没有通过moc运行头文件。