Error with mocs in compiling kdevelop
eric at erixpage.com
Fri Aug 11 22:04:37 UTC 2006
On 8/11/06, Alexander Neundorf <neundorf at kde.org> wrote:
> > I use last cmake version, as given in
> > http://developer.kde.org/build/trunk.html
> So cmake 2.4.3 ?
> > make: *** No rule to make target « lib/weaver/Job.moc », needed by «
> > lib/weaver/CMakeFiles/ThreadWeaver.dir/Job_moc.o ».
> > make: *** no rule to make target « lib/weaver/Thread.moc », needed by «
> > lib/weaver/CMakeFiles/ThreadWeaver.dir/Thread_moc.o ».
> > I added some trace messages in kde4_automoc macro and I see that includes
> > of both missing mocs are well detected and that add_custom_commands are
> > called. But no target is generated in makefiles...
> I had a quick look at the sources.
> Neither Job.cpp nor Thread.cpp are listed as a source file for the library.
> Why ?
Because if Job.cpp and Thread.cpp are listed as sources in addition to
Job_moc.cpp and Thread_moc.cpp, the link fails with many symbols
The problem is that they are needed as sources for their mocs to be
generated, but we want to compile and link Job_moc.cpp and
> And the generated Job_moc.cpp and Thread_moc.cpp include Job.moc and
> Thread.moc ?
> Job_moc.cpp and Thread_moc.cpp do not exist yet at cmake time, so if these
> generated files will include Thread.moc/Job.moc this cannot be detected at
> this time.
Yes, _moc files do not exist, but Job.cpp and Thread.cpp are also part
of the list given to kde4_automoc so includes of Job.moc and
Thread.moc are found there.
To sum up:
- We want Job.moc and Thread.moc to be generated from Job.h and
Thread.h, and Job_moc.cpp and Thread_moc.cpp to be generated from
Job.cpp and Thread.cpp.
- We want *only* Job_moc.cpp and Thread_moc.cpp (including Job.moc and
Thread.moc) to be compiled/linked.
But how to have a moc generated but its including cpp not in the sources list ?
PS: Another solution would be to get rid of Q_OBJECT in cpp files...
More information about the KDevelop-devel