It is a known bug that moc trips over macros used in libstdc++ as documented here: http://lists.kde.org/?l=necessitas-devel&m=132317657926916&q=raw
I am trying to compile a project which uses gcc 4.6.3 and am stuck because moc trips over the macros.
One way to overcome the problem is to include the directives as mentioned in this link:
http://doc.qt.io/qt-4.8/moc.html
but that is time consuming and not a very clean way as every file has to have these directives.
What I'd like to know is, can qmake be configured such as to make moc skip certain directories/files?
edited: typos
According to the Qt qmake docs moc will be run for files that are added to the HEADERS
variable (emphasis mine):
qmake will generate dependency information (unless -nodepend is specified on the command line) for the specified headers. qmake will also automatically detect if moc is required by the classes in these headers, and add the appropriate dependencies and files to the project for generating and linking the moc files.
So if you don't want moc to be run for certain files then don't add them to the HEADERS
in your .pro file. However, for some platforms that might cause the headers not to be found when compiling the corresponding .cpp files. To fix that, add an INCLUDEPATH
for the folders containing such headers - moc won't be run for headers that are inside an INCLUDEPATH
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With