I have a simple class that has a QT signal, which creates problems when compiling the code generated by moc. I do not use the qmake build system, but my scons build script calls the qt 'moc command directly.
The corresponding source file "write_qstring.h" is:
#ifndef LOG_WRITE_QSTRING_POLICY_H
#define LOG_WRITE_QSTRING_POLICY_H
#include <QObject>
#include <QString>
namespace Log
{
class WriteQString : public QObject
{
Q_OBJECT
public:
signals:
void Changed(QString newString);
};
}
#endif
I run the moc compiler with the command:
/opt/Qt/5.2.0/gcc_64/bin/moc -DQT_CORE_LIB -I / opt / Qt / 5.2.0 / gcc_64 / include / QtCore -I / opt / Qt / 5.2.0 / gcc_64 / include -o moc_write_qstring. cc write_qstring.h
and then I compile the generated moc_write_qstring.cc file using clang ++:
clang++ -o moc_write_qstring.o -c -Weverything -pedantic -g -std = ++ 11 -fcxx-exceptions -pthread -fdiagnostics-fixit-info -fPIC -Wno-++ 98-compat -Wno-documentation-unknown-command -Wno-documentation -Wno-padded -Wno-weak-vtables -Wno-exit- -Wno-global-constructors -/opt/Qt/5.2.0/gcc_64/include -isystem/opt/Qt/5.2.0/gcc_64/include/QtCore -DQT_CORE_LIB -I/opt/Qt/5.2. 0/gcc_64/include/QtCore moc_write_qstring.cc
undefined:
: '_t' (aka 'void (Log:: WriteQString:: *) (QString) '), reinterpret_cast 'void **' undefined [-Wundefined-reinterpret-cast] : if (* reinterpret_cast < _t * > (func) == static_cast < _t > (& WriteQString:: Changed)) {
undefined, , , ? ? ++ 11?
clang++ --version
Ubuntu clang version 3.5-1 ~ exp1 (trunk) ( LLVM 3.5) : x86_64-pc-linux-gnu : posix
qmake -version
QMake 3.0 Qt 5.2.0 /opt/Qt/ 5.2.0/gcc_64/lib