我正在使用CodeBlocks。如果需要,这是项目:http://i.imgur.com/Wz8Bya9.png
我是一个非常非常早期的C ++初学者,我一直在为一个RPG游戏的启动器(TTU参考)代码,尝试修复它并运行它。我已经遇到了一些我能够轻松解决的错误,但我遇到了这个障碍,我不确定问题是什么。我想我必须在项目设置中添加来自Qt的库?但我不知道在哪里可以找到这些库文件以及要链接哪些文件等。这是收到这些错误的文件(core \ main.cpp):
#include "ui\LauncherWindow.h"
#include <QtWidgets\QApplication>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
LauncherWindow *launcher_window = new LauncherWindow;
launcher_window->show();
return app.exec();
}
我收到了这些错误:
||=== Build: Debug in TTU_launcher_rebuilt (compiler: GNU GCC Compiler) ===|
obj\Debug\LAUNCHER\launcher-win32-master\src\core\main.o||In function `main':|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\core\main.cpp|7|undefined reference to `_imp___ZN12QApplicationC1ERiPPci'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\core\main.cpp|10|undefined reference to `_imp___ZN7QWidget4showEv'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\core\main.cpp|12|undefined reference to `_imp___ZN12QApplication4execEv'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\core\main.cpp|12|undefined reference to `_imp___ZN12QApplicationD1Ev'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\core\main.cpp|12|undefined reference to `_imp___ZN12QApplicationD1Ev'|
obj\Debug\LAUNCHER\launcher-win32-master\src\core\main.o||In function `ZN7QStringC1EPKc':|
C:\Qt\5.4\msvc2013_64\include\QtCore\qstring.h|601|undefined reference to `_imp___ZN7QString16fromAscii_helperEPKci'|
obj\Debug\LAUNCHER\launcher-win32-master\src\core\main.o||In function `ZN15QTypedArrayDataItE10deallocateEP10QArrayData':|
C:\Qt\5.4\msvc2013_64\include\QtCore\qarraydata.h|222|undefined reference to `_imp___ZN10QArrayData10deallocateEPS_jj'|
obj\Debug\LAUNCHER\launcher-win32-master\src\login\Authenticator.o||In function `ZN13AuthenticatorC2E4QUrl':|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|17|undefined reference to `_imp___ZN4QUrlC1ERKS_'|
obj\Debug\LAUNCHER\launcher-win32-master\src\login\Authenticator.o||In function `ZN13Authenticator5loginERK7QStringS2_S2_':|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|24|undefined reference to `_imp___ZN15QNetworkRequestC1ERK4QUrl'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|25|undefined reference to `_imp___ZN8QVariantC1ERK7QString'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|25|undefined reference to `_imp___ZN15QNetworkRequest9setHeaderENS_12KnownHeadersERK8QVariant'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|25|undefined reference to `_imp___ZN8QVariantD1Ev'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|26|undefined reference to `_imp___ZN8QVariantC1EPKc'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|26|undefined reference to `_imp___ZN15QNetworkRequest9setHeaderENS_12KnownHeadersERK8QVariant'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|26|undefined reference to `_imp___ZN8QVariantD1Ev'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|31|undefined reference to `_imp___ZN21QNetworkAccessManagerC1EP7QObject'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|32|undefined reference to `_imp___ZN21QNetworkAccessManager4postERK15QNetworkRequestRK10QByteArray'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|35|undefined reference to `_imp___ZN10QEventLoopC1EP7QObject'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|37|undefined reference to `_imp___Z13qFlagLocationPKc'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|37|undefined reference to `_imp___Z13qFlagLocationPKc'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|37|undefined reference to `_imp___ZN7QObject7connectEPKS_PKcS1_S3_N2Qt14ConnectionTypeE'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|37|undefined reference to `_imp___ZN11QMetaObject10ConnectionD1Ev'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|38|undefined reference to `_imp___ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|42|undefined reference to `_imp___ZNK13QNetworkReply5errorEv'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|43|undefined reference to `_imp___ZN9QIODevice7readAllEv'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|47|undefined reference to `_imp___ZN7QStringaSERKS_'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|35|undefined reference to `_imp___ZN10QEventLoopD1Ev'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|31|undefined reference to `_imp___ZN21QNetworkAccessManagerD1Ev'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|52|undefined reference to `_imp___ZN15QNetworkRequestD1Ev'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|25|undefined reference to `_imp___ZN8QVariantD1Ev'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|26|undefined reference to `_imp___ZN8QVariantD1Ev'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|35|undefined reference to `_imp___ZN10QEventLoopD1Ev'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|31|undefined reference to `_imp___ZN21QNetworkAccessManagerD1Ev'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|52|undefined reference to `_imp___ZN15QNetworkRequestD1Ev'|
obj\Debug\LAUNCHER\launcher-win32-master\src\login\Authenticator.o||In function `ZN13Authenticator17parse_login_replyERK10QByteArray':|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|60|undefined reference to `_imp___ZN7QStringaSERKS_'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|62|undefined reference to `_imp___ZN13QJsonDocument8fromJsonERK10QByteArrayP15QJsonParseError'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|63|undefined reference to `_imp___ZNK13QJsonDocument6objectEv'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|64|undefined reference to `_imp___ZNK11QJsonObject8containsERK7QString'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|68|undefined reference to `_imp___ZN11QJsonObjectixERK7QString'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|71|undefined reference to `_imp___ZNK11QJsonObject8containsERK7QString'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|72|undefined reference to `_imp___ZN11QJsonObjectixERK7QString'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|77|undefined reference to `_imp___ZNK11QJsonObject8containsERK7QString'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|78|undefined reference to `_imp___ZN11QJsonObjectixERK7QString'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|79|undefined reference to `_imp___ZNK11QJsonObject8containsERK7QString'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|80|undefined reference to `_imp___ZN11QJsonObjectixERK7QString'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|63|undefined reference to `_imp___ZN11QJsonObjectD1Ev'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|62|undefined reference to `_imp___ZN13QJsonDocumentD1Ev'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|63|undefined reference to `_imp___ZN11QJsonObjectD1Ev'|
C:\Users\Thomas\Desktop\TTU\LAUNCHER\launcher-win32-master\src\login\Authenticator.cpp|62|undefined reference to `_imp___ZN13QJsonDocumentD1Ev'|
obj\Debug\LAUNCHER\launcher-win32-master\src\login\Authenticator.o||In function `ZN10QArrayData10sharedNullEv':|
C:\Qt\5.4\msvc2013_64\include\QtCore\qarraydata.h|116|undefined reference to `_imp___ZN10QArrayData11shared_nullE'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build failed: 50 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
那么有人可以解释究竟是什么问题,以及如何解决它?非常感谢你提前。 -Intoxadox:)
答案 0 :(得分:0)
只需在编译器设置&gt;下添加qt库文件(.lib)的路径。链接。也许它无法找到所需的库,因此您需要检查编译器设置