Results 1 to 4 of 4

Thread: Visual C++ compiler - moc generation

  1. #1
    Join Date
    Apr 2010
    Location
    Porto Alegre, RS, Brazil
    Posts
    37
    Thanks
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Question Visual C++ compiler - moc generation

    Hi everyone.

    I'm using QT Creator and the microsoft compiler in a project. However, I'm getting now some compiler errors (linker) due to some classes (Q_OBJECT) that I've added. I believe it is happening because there are .mocs to be generated and I believe the compiler is not generating them. Here are the error messares:

    Qt Code:
    1. HpQCarouselEnvelope.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall Hp::Psg::HpQCarouselEnvelope::metaObject(void)const " (?metaObject@HpQCarouselEnvelope@Psg@Hp@@UBEPBUQMetaObject@@XZ)
    2. HpQCarouselEnvelope.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall Hp::Psg::HpQCarouselEnvelope::qt_metacast(char const *)" (?qt_metacast@HpQCarouselEnvelope@Psg@Hp@@UAEPAXPBD@Z)
    3. HpQCarouselEnvelope.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall Hp::Psg::HpQCarouselEnvelope::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@HpQCarouselEnvelope@Psg@Hp@@UAEHW4Call@QMetaObject@@HPAPAX@Z)
    4.  
    5. command failed with exit code 1120
    6. jom 0.8.3 - empower your cores
    7.  
    8. command failed with exit code 2
    9. The process "C:/Qt/qtcreator-1.3.85/bin/jom.exe" exited with code %2.
    10. Error while building project Apollo (target: Desktop)
    11. When executing build step 'Make'
    To copy to clipboard, switch view to plain text mode 

    Is there anyone here that could help me, maybe a link teaching me how to force moc generation...

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Visual C++ compiler - moc generation

    Do you use the Qt VS addin? That normally handles all the MOC stuff for you.

  3. The following user says thank you to squidge for this useful post:

    leoalvesmachado (22nd June 2010)

  4. #3
    Join Date
    Jul 2008
    Posts
    424
    Thanks
    9
    Thanked 54 Times in 52 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Visual C++ compiler - moc generation

    Hi, you can add the moc call manually:
    right-click the header of you class -> Properties -> Custom Build Step; add your moc call. Don't forget to add the generated moc_<classname>.cpp to your project.

    But sometimes it helps to remove the class from the project once and add it again, the VS Addin will add the necessary steps for you.

    Ginsengelf

  5. The following user says thank you to Ginsengelf for this useful post:

    leoalvesmachado (22nd June 2010)

  6. #4
    Join Date
    Jul 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Visual C++ compiler - moc generation

    I also want to the answer!Please help me!!!

Similar Threads

  1. Qt + Visual C++ 2008 + Intel C++ compiler
    By banita in forum Qt Tools
    Replies: 3
    Last Post: 5th April 2010, 20:33
  2. Replies: 1
    Last Post: 16th March 2010, 18:41
  3. MingW x Visual Studio compiler
    By john_god in forum Installation and Deployment
    Replies: 2
    Last Post: 22nd September 2008, 17:06
  4. How to deal with jpeg deployment problem with Visual C++ compiler
    By nooky59 in forum Installation and Deployment
    Replies: 5
    Last Post: 27th March 2008, 11:20
  5. Replies: 7
    Last Post: 24th March 2007, 13:53

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.