![]() Registered Member ![]()
|
Hi all,
I created a project at first with KDevelop. Later on I added slots to a new class and found out I couldn't use it (When running I got a message that this slot does not exist). I found out that moc should be run on this file and then it worked for me. Someone proposed to use qt4_wrap_cpp to get this done automatically. However I didn't get it working. I looked here: http://techbase.kde.org/Development/Too ... eLists.txt And found:
So I tried a few things but none gave me the correct result. This is the CMakeLists file I have now:
This file got generated by KDevelop. So I actually don't have any experience writing this. I added these lines:
However that came up with some errors about invalid reference. Automoc4 is installed. I tried commenting out kde4_add_executable but that didn't help either. Can anyone point me in the correct direction? Thanks in advance! EDIT: Errrr... I was just fiddling around and I got it compiling:
The first line I commented out and the automoc lines I added after it. Make clean make This seems to compile and link. However I am still wondering if this is the way it should be done. Thanks in advance on any remarks! |
![]() Registered Member ![]()
|
Hi,
I have also recently started to program in Qt4 on KDevelop. So, I have suffered the same problem you have. Fortunately, I think I have a solution for your problem. Quite likely, all you have to do it's follow the next steps: 1.- First of all, go to your build dir and remove it all (rm .../build/* -rf) 2.- If your class ExampleClass is in file exampleclass.h and exampleclass.cpp, add at the end of exampleclass.cpp the next line:
You will see the exampleclass.moc file is creating when you build. Pay attention to this as it's essential. Regarding your CMakeLists.txt file, the only thing you must make sure to include it's the next line:
Now it's time to build your project and keep your finger crossed. I hope it works! ![]() |
Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft