Qt5未定义引用`QDeclarativeDebuggingEnabler :: QDeclarativeDebuggingEnabler()'

时间:2015-07-22 16:36:39

标签: c++ qt qml undefined-reference

突然出现了这个问题...

classitem.o: In function `__static_initialization_and_destruction_0':
/../../Qt/5.4/gcc_64/include/QtDeclarative/qdeclarativedebug.h:50: undefined reference to `QDeclarativeDebuggingEnabler::QDeclarativeDebuggingEnabler()'
collect2: error: ld returned 1 exit status
make: *** [MedJournal] Error 1
09:29:05: The process "/usr/bin/make" exited with code 2.

甚至从对象中剥离QObject类,但仍然遇到了同样的错误。

2 个答案:

答案 0 :(得分:0)

事实证明,由于某种原因,这条线路造成了所有麻烦:

#include <QtDeclarative/QDeclarativeView>

答案 1 :(得分:0)

请记住启用调试时QtQuick1和QtQuick2之间存在差异:

QtQuick1

#include <QtDeclarative/qdeclarativedebug.h>
QDeclarativeDebuggingEnabler enabler;

QtQuick2

#include <QQmlDebuggingEnabler>
QQmlDebuggingEnabler enabler;

因为你使用的是Qt5.4,QtQuick2是自Qt5以来我认为,这可能是问题所在。