[Interest] moc - specify include headers?

Thiago Macieira thiago.macieira at intel.com
Wed Jan 30 19:10:58 CET 2013


On quarta-feira, 30 de janeiro de 2013 10.15.49, Charley Bay wrote:
> 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).

#include "moc_MyClass.cpp" at the end of your MyClass.cpp.

qmake will see the include and will not try to compile it separately.

> 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?

Are you saying that, with the #include, the generated vcproj file does not 
compile as nmake would on the command-line?

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130130/a1347217/attachment.sig>


More information about the Interest mailing list