[英]qt linker error with emit signal from another thread
I'll try emit signal from another thread. 我将尝试从另一个线程发出信号。 My compilation say next error
我的编译说下一个错误
/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)
It's all about this: 都是关于这个的:
#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());
....
}
But if i commented this string all program working is correctly 但是,如果我注释了此字符串,则所有程序正常运行
您或者缺少loopThread中的Q_OBJECT宏,或者没有通过moc运行头文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.