Results 1 to 2 of 2

Thread: MOC created file compiled twice

  1. #1
    Join Date
    May 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default MOC created file compiled twice

    I am using a 3rd party class from wwWidgets that compiles fine. The class (qwwLongSpinBox) is run through moc and a moc_qwwlongspinbox.cpp file is generated. It is included in qwwlongspinbox.cpp and comiled there and most importantly only compiled there.

    Now if I duplicate the files/class into qwwuintspinbox all is good except that the qmake generated Makefile tries to compile moc_qwwuintspinbox.cpp seperately which produces compile time errors.

    So the question is: what makes qmake NOt add a file (in this case moc_qwwlongspinbox.cpp) for compilation?
    I don't see any flags or what not.

    Thanks,
    Dan

  2. #2
    Join Date
    May 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MOC created file compiled twice

    I figured out what was wrong.

    First: The reason that moc files are NOT part of the makefile sources is because they are included in some .cpp file. Qmake filters these out.

    Second: Qmake did not filter out my file, so it compiled twice, because the case of the file name did not match the actual file name, WIndows not being case sensitive allowed the include to work.

    I had:
    #include "moc_MyFile.cpp"

    Fix:
    #include "moc_myfile.cpp"

Similar Threads

  1. Replies: 5
    Last Post: 10th November 2009, 15:46
  2. examining an sqlite db file created by QSqlDatabase
    By gmseed in forum Qt Programming
    Replies: 1
    Last Post: 16th October 2009, 15:54
  3. Replies: 1
    Last Post: 28th January 2009, 09:21
  4. Replies: 3
    Last Post: 6th February 2008, 12:53
  5. Replies: 25
    Last Post: 15th January 2006, 00: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.