Results 1 to 6 of 6

Thread: cannot compile the MainWindow example with vs2005

  1. #1
    Join Date
    Aug 2006
    Posts
    24
    Qt products
    Qt4
    Platforms
    Windows

    Unhappy cannot compile the MainWindow example with vs2005

    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
    Last edited by jacek; 31st August 2006 at 14:07. Reason: changed [ code ] to [ quote ] to allow wrapping

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: cannot compile the MainWindow example with vs2005

    You didn't run moc, better try to compile it using qmake.

  3. #3
    Join Date
    Aug 2006
    Posts
    24
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: cannot compile the MainWindow example with vs2005

    hi, thanks, but what is moc and can i still compile it with vs2005? cause i wanna use the debug feature of vs2005

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: cannot compile the MainWindow example with vs2005

    Quote Originally Posted by billconan
    what is moc
    Meta-Object Compiler

    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.
    J-P Nurmi

  5. #5
    Join Date
    Jan 2006
    Location
    Mountain View, CA
    Posts
    279
    Thanked 42 Times in 37 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: cannot compile the MainWindow example with vs2005

    Quote Originally Posted by billconan
    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.
    Save yourself some pain. Learn C++ before learning Qt.

  6. #6
    Join Date
    May 2008
    Location
    Sofia
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: cannot compile the MainWindow example with vs2005

    You probably forgot to use application.qrc and put images in project directory, wich are needed...

Similar Threads

  1. Installing Qt 4.1.4 (open source) on windows with vs2005
    By Randulf in forum Installation and Deployment
    Replies: 1
    Last Post: 19th August 2006, 12:22
  2. Replies: 3
    Last Post: 23rd July 2006, 18:02
  3. how to correctly compile threads support?
    By srhlefty in forum Installation and Deployment
    Replies: 9
    Last Post: 25th June 2006, 19:15
  4. Can't Compile Tutorial 7
    By Reenen in forum Newbie
    Replies: 10
    Last Post: 9th February 2006, 14:06
  5. mainwindow does not refresh
    By edb in forum Qt Programming
    Replies: 22
    Last Post: 25th January 2006, 16:42

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.