[Interest] moc - specify include headers?

Charley Bay charleyb123 at gmail.com
Wed Jan 30 18:15:49 CET 2013


I'm using "qmake -tp vc" to generate MSVC *.vcproj files, works great.
 (Qt5, wrapping C++ classes for exposure to QML.)

I'm doing some "tricky-template" stuff, and I *cannot* include the template
implementation in the "MyClass.hpp" header, but I *can* explicitly include
the template implementation into the the "MyClass.cpp".

ISSUE:  The moc-generated "moc_MyClass.cpp" won't compile because it
*needs* my template implementation(s).  By default, it only includes
"MyClass.hpp", which is not enough (I need it to explicitly include my
template implementations).

I see the "moc -b<file>" feature, but that looks like something more for
"precompiled headers".  Further, it's not clear how to get this option to
work properly through my current workflow (*.pro ==>moc==> *.vcproj).

I *think* I need to go back to the "old-moc-workflow" where I "#include"
the moc-generated file directly into my "MyClass.cpp", below where I
include the template-implementation-headers (and the moc-generated file
would no longer be compiled separately).  However, I'm also having trouble
getting that into my workflow (*.pro ==>moc==> *.vcproj).

Does anyone have suggestions, or a tutorial somewhere on how to do this?

--charley
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130130/22c0f878/attachment.html>


More information about the Interest mailing list