PDA

View Full Version : MOC created file compiled twice



DanReed
2nd June 2010, 18:28
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

DanReed
11th June 2010, 16:10
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"