Path/Configuration problem with Qt SDK and Code::Blocks
I'm new to Code::Blocks (nice IDE!) and to Qt with C++ (been using PyQt, which works wonderfully)
I have a test project - here's the code (generate开发者_如何学运维d by code::blocks wizard):
#include <QApplication>
#include <QFont>
#include <QPushButton>
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QPushButton quit("Quit");
quit.resize(75, 30);
quit.setFont(QFont("Times", 18, QFont::Bold));
QObject::connect(&quit, SIGNAL(clicked()), &app, SLOT(quit()));
quit.show();
return app.exec();
}
I BELIEVE I have the search path for Qt4 configured correctly in code::blocks, but when I try to run this code I get the below listed errors - so obviously I'm missing something - either my paths are in correct or my installation is corrupt. For my Qt installation I used Qt_SDK_Win_offline_v1_1_2_en.exe, found on the Qt website - installed the entire Qt SDK in D:, so the root path for the Qt installation is D:\QtSDK..
Any help on how to fix this configuration would be appreciated - I am excited about using Qt with C++ after fighting with Win32s/MFC/.NET etc etc for so many years....
Errors:
||=== QtTest, Debug ===|
obj\Debug\main.o||In function `main':|
E:\ResourceBrowse\QtTest\main.cpp|7|undefined reference to >`imp__ZN12QApplicationC1ERiPPci'|
E:\ResourceBrowse\QtTest\main.cpp|9|undefined reference to `imp__ZN11QPushButtonC1ERK7QStringP7QWidget'|
E:\ResourceBrowse\QtTest\main.cpp|12|undefined reference to `imp__ZN5QFontC1ERK7QStringiib'|
E:\ResourceBrowse\QtTest\main.cpp|12|undefined reference to `imp__ZN7QWidget7setFontERK5QFont'|
E:\ResourceBrowse\QtTest\main.cpp|12|undefined reference to `imp__ZN5QFontD1Ev'|
E:\ResourceBrowse\QtTest\main.cpp|12|undefined reference to `imp__ZN5QFontD1Ev'|
E:\ResourceBrowse\QtTest\main.cpp|14|undefined reference to `imp__Z13qFlagLocationPKc'|
E:\ResourceBrowse\QtTest\main.cpp|14|undefined reference to `imp__Z13qFlagLocationPKc'|
E:\ResourceBrowse\QtTest\main.cpp|14|undefined reference to `imp__ZN7QObject7connectEPKS_PKcS1_S3_N2Qt14ConnectionTypeE'|
E:\ResourceBrowse\QtTest\main.cpp|18|undefined reference to `imp__ZN12QApplication4execEv'|
E:\ResourceBrowse\QtTest\main.cpp|18|undefined reference to `imp__ZN11QPushButtonD1Ev'|
E:\ResourceBrowse\QtTest\main.cpp|18|undefined reference to `imp__ZN11QPushButtonD1Ev'|
E:\ResourceBrowse\QtTest\main.cpp|18|undefined reference to `imp__ZN12QApplicationD1Ev'|
E:\ResourceBrowse\QtTest\main.cpp|18|undefined reference to
_imp___ZN12QApplicationD1Ev'| obj\Debug\main.o||In function
QString':|D:\QtSDK\Desktop\Qt\4.7.3\msvc2008\include\QtCore\qstring.h|426|undefined reference to
_imp___ZN7QString16fromAscii_helperEPKci'| obj\Debug\main.o||In function
~QString':|D:\QtSDK\Desktop\Qt\4.7.3\msvc2008\include\QtCore\qstring.h|883|undefined reference to `imp__ZN7QString4freeEPNS_4DataE'|
obj\Debug\main.o:D:\QtSDK\Desktop\Qt\4.7.3\msvc2008\include\QtGui\qwidget.h|1001|undefined reference to `imp__ZN7QWidget6resizeERK5QSize'|
||=== Build finished: 17 errors, 0 warnings ===|
精彩评论