I install dev-c++ and then "QT open source with mingw".
And,I select dev-cpp/bin as mingw directory in first step of the installation of QT.
All goes ok.
I add the qt/lib qt/include dirs to dev-cpp's compiler option.
When I build the code snippet below.Link error.
#include<QtGui/QApplication>
#include<QtGui/QPushButton>
int main(int argc,char* argv[])
{
//QPushButton hello("Hello World");
//hello.resize(100,300);
//hello.show();
return app.exec();
}
#include<QtGui/QApplication>
#include<QtGui/QPushButton>
int main(int argc,char* argv[])
{
QApplication app(argc,argv);
//QPushButton hello("Hello World");
//hello.resize(100,300);
//hello.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
errors:
[Linker error] undefined reference to `_imp___ZN12QApplicationC1ERiPPc'
[Linker error] undefined reference to `_imp___ZN12QApplication4execEv'
[Linker error] undefined reference to `QApplication::~QApplication()'
[Linker error] undefined reference to `QApplication::~QApplication()'
ld returned 1 exit status
build logs:
Compiler: Default compiler
Executing mingw32-g++.exe...
mingw32-g++.exe "M:\实验\qtHello.cpp" -o "M:\实验\qtHello.exe" -I"M:\dev_tool\Dev-Cpp\include\c++" -I"M:\dev_tool\QT4\include" -L"M:\dev_tool\QT4\lib" -L"M:\dev_tool\Dev-Cpp\lib"
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccwRaaaa.o(.text+0x171):qtHello.cpp: undefined reference to `_imp___ZN12QApplicationC1ERiPPc'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccwRaaaa.o(.text+0x17f):qtHello.cpp: undefined reference to `_imp___ZN12QApplication4execEv'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccwRaaaa.o(.text+0x19d):qtHello.cpp: undefined reference to `QApplication::~QApplication()'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccwRaaaa.o(.text+0x1c6):qtHello.cpp: undefined reference to `QApplication::~QApplication()'
collect2: ld returned 1 exit status
Execution terminated
Thanks
Bookmarks