PDA

View Full Version : cannot compile the MainWindow example with vs2005



billconan
31st August 2006, 15:03
hi guys, i'm new to qt4, and i can compile the hello world example perfectly, but when i tried the MainWindow, i failed. i have already enclosed all the lib files in my project. but still, it does not work.:(

i don't know why, please help. thanks. this is what i got:



------ Build started: Project: qtTest, Configuration: Debug Win32 ------
Linking...
Main.obj : error LNK2019: unresolved external symbol "int __cdecl qInitResources_application(void)" (?qInitResources_application@@YAHXZ) referenced in function _main
MainWindow.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall MainWindow::metaObject(void)const " (?metaObject@MainWindow@@UBEPBUQMetaObject@@XZ)
MainWindow.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall MainWindow::qt_metacast(char const *)" (?qt_metacast@MainWindow@@UAEPAXPBD@Z)
MainWindow.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall MainWindow::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@MainWindow@@UAEHW4Call@QMetaObject@@ HPAPAX@Z)
MainWindow.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const MainWindow::staticMetaObject" (?staticMetaObject@MainWindow@@2UQMetaObject@@B)
C:\Documents and Settings\billconan\桌面\qtTest\Debug\qtTest.exe : fatal error LNK1120: 5 unresolved externals

jacek
31st August 2006, 15:08
You didn't run moc, better try to compile it using qmake.

billconan
31st August 2006, 18:19
hi, thanks, but what is moc and can i still compile it with vs2005? cause i wanna use the debug feature of vs2005:(

jpn
31st August 2006, 18:35
what is moc
Meta-Object Compiler (http://doc.trolltech.com/4.1/moc)

There is a separate VS integration package to install if you have a commercial license.
If you are using an open source version, take a look at: Qt4 with Visual Studio (http://qtnode.net/wiki/Qt4_with_Visual_Studio).

Chicken Blood Machine
31st August 2006, 19:01
hi, thanks, but what is moc and can i still compile it with vs2005? cause i wanna use the debug feature of vs2005:(

Even if you compile it from the command-line, using qmake and nmake, the exact same compiler used by Visual Studio is used (cl.exe). You can still debug any executable produced this way.

tevenen
31st May 2008, 19:27
You probably forgot to use application.qrc and put images in project directory, wich are needed...