Bug 61164

Summary: Project, New Class does not generate @include "fielname.moc"
Product: [Applications] kdevelop Reporter: Ian Wadham <iandw.au>
Component: Language Support: CPP (old)Assignee: KDevelop Developers <kdevelop-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 3.0.0a4   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Ian Wadham 2003-07-13 00:47:12 UTC
Version:           3.0.0a4 (using KDE 3.1.1)
Compiler:          gcc version 3.3 20030226 (prerelease) (SuSE Linux)
OS:          Linux (i686) release 2.4.20-4GB

I am working with TWO targets.  Gideon generated target 1 when I
generated my application as a "C++, KDE, Application framework".
I used "Project, New Class" and it added the new class to target 1,
which compiled and built OK.  Then I added the new class's .cpp file
to target 2.  It compiled OK, but failed to link (using libtool I think).
Errors were "vtable undefined", with references to empty code lines
(i.e. "}" at end of code block).  After hours of trial and error, fiddling
with the source code and adding libraries to target 2, I realised the
REAL BUG is ...

"Project, New Class" does not generate #include "classname.moc"
in the .cpp file, though it knows to generate the "Q_OBJECT" line.

In target 1, file "classname.moc.cpp" was generated (don't know what
that is) and I think it kept the compiler happy.  When I inserted the
missing #include, I STILL got a "classname.moc missing" error,
but after Clean Project, Distclean, Automake and friends, etc., it all
clicked into place and both targets compiled and built OK.

BTW, I don't know whether this is a bug, a blemish, a design problem
or a wish list, but the whole synchronisation of Automake Manager with
generated Makefiles seems to be chancy (particularly where MOC is
involved).  From an end-user's point of view, I never know for certain
how far back in the chain I have to go after I make a code change or
an Automake Manager change.

Often I go right back to Clean Project and Distclean, just to be sure,
but that is very time-consuming and defeats the whole purpose of
KDevelop, doesn't it?
Comment 1 Alexander Dymo 2003-07-14 16:32:40 UTC
"make force-reedit" will help to avoid moc related problems 
Comment 2 Alexander Dymo 2003-07-25 21:54:23 UTC
Subject: kdevelop

CVS commit by dymo: 

Added Options enum and options() virtual method to KDevProject interface so C++ New Class and Subclassing wizards can query if include "file.moc" string is required for QObject descendants in the current project.
CCMAIL: 61164-done@bugs.kde.org
Added EnvVarTools module to lib/project. It contains one function quote() that serves as a replacement to KProcess::quote. The only difference is that this function quotes with " sign to enable shell variable expansion.
Changed KProcess::quote() to EnvVarTools::quote() in all project parts.
Added "Force Reedit", "Install" and "Install (as root user)" actions into the subproject menu for automake. Force reedit is only available for KDE projects.
Trollproject can now find the appropriate executable for a subproject even if output file name isn't set.


  A            lib/project/envvartools.cpp   1.1 [GPL (v2+)]
  A            lib/project/envvartools.h   1.1 [GPL (v2+)]
  M +5 -0      lib/interfaces/kdevproject.cpp   1.5
  M +4 -0      lib/interfaces/kdevproject.h   1.21
  M +2 -1      lib/project/Makefile.am   1.6
  M +12 -0     parts/autoproject/autoprojectpart.cpp   1.102
  M +1 -0      parts/autoproject/autoprojectpart.h   1.36
  M +51 -5     parts/autoproject/autosubprojectview.cpp   1.12
  M +6 -0      parts/autoproject/autosubprojectview.h   1.3
  M +7 -0      parts/cppsupport/cppnewclassdlg.cpp   1.44
  M +7 -0      parts/cppsupport/subclassingdlg.cpp   1.13
  M +7 -0      parts/customproject/customprojectpart.cpp   1.56
  M +4 -0      parts/pascalproject/pascalproject_part.cpp   1.11
  M +9 -0      parts/trollproject/trollprojectpart.cpp   1.60
  M +1 -0      parts/trollproject/trollprojectpart.h   1.23
  M +7 -1      parts/trollproject/trollprojectwidget.cpp   1.110