I compile a Qt executable using qmake && make
on the following project.pro
file:
INCLUDEPATH *= ../../dependencies/boost
QT
In my code in header files I just have:
#ifndef Q_MOC_RUN
//Here we include Boost or Ogre headers with Macro
#endif
It works perfectly in Qt5 x64 and need not recompiling anything.
A bit hackish, but what about if you overwrite the moc compiler so that it includes the flag. In the .pro:
QMAKE_MOC = $$QMAKE_MOC -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED
For add specific flags to moc in a qmake project(qt5.2) need:
load(moc)
QMAKE_MOC += -DBOOST_INCLUDE_GUARD_GOES_HERE
In case you are doing Ogre3D (OGRE 1.8.1 SDK for Visual C++ .Net 2010 (32-bit) ) then use QT5 32bit instead of the QT5 64bit version, it will pass.
Also consider this :
#ifndef BOOST_SYSTEM_NO_DEPRECATED
#define BOOST_SYSTEM_NO_DEPRECATED 1
#endif
I think it has been compiled (boost included) with 32bit thus i suppose i have to take src and recompile (using my 64bit) but thats another story where i wont go for now since OGRE 1.9 RC 1 SDK for Visual C++ .Net 2012 (64-bit) will be soon release on stable version.
Regards
EDIT 1 :
Downloaded Qt libraries 4.8.4 for Windows and configured my QT creator (the one coming with full QT5 and guess what …. Ogre3D is working like a charm when compiling on 4.8.4.
Qt 5.0.2 for Windows 32-bit (VS 2010, 485 MB)
Qt libraries 4.8.4 for Windows (VS 2010, 234 MB)
OGRE 1.8.1 SDK for Visual C++ .Net 2010 (32-bit)
I also mentionned it for who is interested here : http://qt-project.org/forums/viewreply/128660/
The best way I found to do this is based on a comment on the accepted solution from David Faure:
QMAKE_MOC_OPTIONS += -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED
The other proposed methods that involve load(moc)
and manipulating the QMAKE_MOC
variable itself have an unfortunate side effect: they prevent qmake from automatically adding INCLUDEPATH
variables (and maybe others) that would normally be on moc's command line, if INCLUDEPATH
is set up after the call to load(moc)
.
This approach composes easier if you have your qmake configuration split up to multiple files; you don't need to ensure that the change to the moc command line comes after all INCLUDEPATH
directories are set.
There is an update to this issue for boost 1.53, see the last post here:
We need to add -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
also.