[Development] qt5 modules in namespaces

marius.storm-olsen at nokia.com marius.storm-olsen at nokia.com
Tue Jan 3 19:16:46 CET 2012


On 03/01/2012 12:01, ext Thiago Macieira wrote:
> On Tuesday, 3 de January de 2012 18.19.47, Denis Dzyubenko wrote:
>> That's the thing - it doesn't work in some cases - if you do
>> in-source-tree build of the attached project. Well now thinking
>> about it, it is probably a bug in qmake.

Sounds like you have an include path "bug" in your .pro file then. qmake 
doesn't care about where that file is located. As long as you
     #include <moc_file.cpp>
qmake will remove it from the object list, thus not include it in the 
compile.


>> This is because qmake decided that moc_bar.cpp should be compiled
>> as a separate module, but moc didn't know about the namespace, so
>> compilation fails. Instead moc_bar.cpp should not be compiled
>> separately, but included from bar.cpp.
>
> qmake has some logic to detect when a .cpp is #included by another
> .cpp, so it won't try to compile it. That should have kicked in.
>
> I know that because I had the exactly opposite problem Friday: I had
> one .cpp (qdrawhelper.cpp) that I wanted to be compiled on its own
> *and* as an #include from somewhere else. qmake wouldn't do it.

You need to compile that moc file as a separate lib then, and include it 
on the link line. It's bizzar to compile the same compile unit twice in 
the *same* project.

-- 
.marius


More information about the Development mailing list