Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

main.obj LNK2011 error lead to compile failure in a very simple code

$
0
0
Hi.I’m new to Qt and I’m using Qt Creator 5.0.0 in Windows 7. I built a simple console project to test and learn to use QtNetwork/QNetworkAccessManager.Here is the code. main.cpp: #include <QCoreApplication> #include <QtNetwork/QNetworkAccessManager> int main(int argc, char *argv[]) {     QCoreApplication a(argc, argv);     QNetworkAccessManager NAM;         return a.exec(); } the .pro file:(It’s generated by Qt Creator automatically and I didn’t change it) QT       += core QT       -= gui TARGET = XALFtest2 CONFIG   += console CONFIG   -= app_bundle TEMPLATE = app SOURCES += main.cpp When I try to compile it,it reports errors like this “main.obj:-1: Error:LNK2001: Unresolved external symbol “__declspec(dllimport) public: virtual __thiscall QNetworkAccessManager::~QNetworkAccessManager(void)” (__imp_??1QNetworkAccessManager@@UAE@XZ)” and fails to compile. I’ve searched about it for a long time on the Internet,I’ve tried to add “LIB+=Qt5Network.lib” ,and “QT += network” in the .pro file,and it didn’t work. I’ll really appreciate it if you give me any suggestions or tell me any documentation about the problem.Many thanks.

Viewing all articles
Browse latest Browse all 18427

Trending Articles