I copy Qt example:C:\Qt\4.0.1\examples\widgets\calculator to myself path;I create Qt Application project by Code::Blocks,Add all .cpp and .h to the project,then I compile the project. It shows that #include <QtGui> QtGui no such file or directory. I modify the code as : #include <QtGui/QtGui>, the compiler is pass ,but at the build time,it shows the message below:
Project : qtApp
Compiler : GNU GCC Compiler (called directly)
Directory : C:\Documents and Settings\Administrator\My Documents\calculator\
--------------------------------------------------------------------------------
Switching to target: default
Compiling: button.cpp
Linking executable: C:\Documents and Settings\Administrator\My Documents\calculator\calculator.exe
.objs\calculator.o:calculator.cpp:(.text+0x181): undefined reference to `vtable for Calculator'
.objs\calculator.o:calculator.cpp:(.text+0x18d): undefined reference to `vtable for Calculator'
.objs\calculator.o:calculator.cpp:(.text+0x1c2d): undefined reference to `vtable for Calculator'
.objs\calculator.o:calculator.cpp:(.text+0x1c39): undefined reference to `vtable for Calculator'
.objs\calculator.o:calculator.cpp:(.text$_ZN10Calculator2trEPKcS1_[Calculator::tr(char const*, char const*)]+0x1c): undefined reference to `Calculator::staticMetaObject'
.objs\calculator.o:calculator.cpp:(.text$_Z12qobject_castIP6ButtonET_P7QObject[Button* qobject_cast<Button*>(QObject*)]+0x10): undefined reference to `Button::staticMetaObject'
.objs\main.o:main.cpp:(.text$_ZN10CalculatorD1Ev[Calculator::~Calculator()]+0x3a): undefined reference to `vtable for Calculator'
.objs\main.o:main.cpp:(.text$_ZN10CalculatorD1Ev[Calculator::~Calculator()]+0x46): undefined reference to `vtable for Calculator'
.objs\button.o:button.cpp:(.text+0x155): undefined reference to `vtable for Button'
.objs\button.o:button.cpp:(.text+0x161): undefined reference to `vtable for Button'
.objs\button.o:button.cpp:(.text+0x2d3): undefined reference to `vtable for Button'
.objs\button.o:button.cpp:(.text+0x2df): undefined reference to `vtable for Button'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 3 seconds)
0 errors, 0 warnings
I can't build the application,and I don't know why? Can anyone help me, Thanks a lots!