Results 1 to 2 of 2

Thread: Cannot create a QT exe+lib with Visual Studio 2005

  1. #1
    Join Date
    Aug 2009
    Posts
    92
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Cannot create a QT exe+lib with Visual Studio 2005

    I have a big problem with VS+QT.
    I'm working on a project called DGC (Dynamic Gui Creator) that is working on Linux Ubuntu but not in Windows XP.

    I've tried with Cmake and with the QT4 VS add-in but nothing, I cannot create a library and an executable beacuse I get all these errors:
    Qt Code:
    1. CMainApp.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall DynamicGUICreator::FreqButtonItem::metaObject(void)const " (?metaObject@FreqButtonItem@DynamicGUICreator@@UBEPBUQMetaObject@@XZ)
    2. main.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall DynamicGUICreator::FreqButtonItem::metaObject(void)const " (?metaObject@FreqButtonItem@DynamicGUICreator@@UBEPBUQMetaObject@@XZ)
    3. moc_CMainApp.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall DynamicGUICreator::FreqButtonItem::metaObject(void)const " (?metaObject@FreqButtonItem@DynamicGUICreator@@UBEPBUQMetaObject@@XZ)
    4. ... (many others similar)
    To copy to clipboard, switch view to plain text mode 

    If I create only the executable compiling and linking all the modules, it's ok, but if I create first the library and afterwards the executable that links to the library, I get all those errors.

    Note that if I use the .pro files with Eclipse (mingw), everything works but the problem is that I have to compile with VS.

    It seems that the created library has no moc information...

    Can someone help me, please ?
    thanks.

  2. #2
    Join Date
    Aug 2009
    Posts
    92
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Cannot create a QT exe+lib with Visual Studio 2005

    I've seen that, if I create a static library, I don't get the previous linker errors but only the following (for each moc file):

    Qt Code:
    1. DGClib.lib(moc_FreqButtonItem.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
    To copy to clipboard, switch view to plain text mode 

    So, I think that the problem is in the generated moc files (.cxx) as the functions like qt_metacast or qt_metacall are not exported (__declspec(dllexport)).

    Can somebody confirm ?

Similar Threads

  1. Qt in visual studio 2005
    By semden in forum Installation and Deployment
    Replies: 8
    Last Post: 31st October 2009, 00:52
  2. qwt and visual studio 2005
    By stefan in forum Qwt
    Replies: 4
    Last Post: 30th September 2008, 11:25
  3. Using QT in Visual Studio 2005
    By mittalpa in forum Newbie
    Replies: 1
    Last Post: 1st July 2008, 17:19
  4. QT - Visual Studio 2005
    By sabeesh in forum Qt Programming
    Replies: 1
    Last Post: 13th August 2007, 07:20
  5. Qt 4.1.0 on Visual Studio 2005
    By nErnie in forum Installation and Deployment
    Replies: 8
    Last Post: 6th July 2006, 00:56

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.