Nasty error message

Adam Treat treat at kde.org
Wed Jul 12 19:01:44 CEST 2006


I had a class called Foo that was declared and implemented in the standard 
files foo.cpp and foo.h

Foo inherited QObject and had the customary moc 
include directive at the bottom: #include  "foo.moc"

During the course of events, I decided to rename this class FooBar, so I 
changed the filename to foobar.cpp and foobar.h, respectively.  Unfortunately, 
I forgot to change the include directive foo.moc :(

CMake did not like this and would not build, complaining that it could not 
find the required file "foo.h"

So, I went through my source directory and could find no mention of foo.h nor 
could I find the file.  grep foo.h * -r in the src directory AND build 
directory turned up absolutely nothing.  I deleted the build directory and 
started over.  Same error message.  I could not figure out how in the hell 
would cmake complain to me about a file that was not mentioned ANYWHERE in 
any file in either the source directory or the build directory.

After quite a lot of lost time, I finally figured out that it was referring to 
the foo.moc directive that I forgot to change.

Could the CMake gurus be so kind as to have CMake complain about foo.moc 
instead of foo.h if this happens again?

Adam


More information about the Kde-buildsystem mailing list