Registered Member
|
I've decided to learn QT.
I wanted to know the best way to go about setting up Kdevelop to play well with QT. So far the only thing I've done is install qt-dev files and I'm having some rather annoying quirks with the default QT graphical application template project: 1- I can't rename my GUI header. If I do the project won't compile. This is rather annoying because the header initially gets the name of the project. 2- I can't seem to add QT SLOTS to the default class. I get the following error: "undefined reference to `class_name::function_name()" in project_name.moc 3- If I try to disable this whole moc nonsense by commenting out the include declaration I get: undefined reference to `vtable for class_name I can compile and run my code fine if I do it manually: qmake -project, qmake, make as instructed in the tutorial I'm following: http://qt-project.org/doc/qt-4.8/gettingstartedqt.html. I'm using KDE 4.14.2, QT 4.8 and Kdevelop 4.7. I would greatly appreciate if you guys have any tips or suggestions. I really like Kdevelop and don't want to install QtCreator. Thank you. |
Global Moderator
|
If you rename your header you have to change the qmake file as well.
You can't disable "the whole moc nonsense", it is an integral part of Qt. For further advice, please post your code, it's hard to help otherwise. Greetings!
I'm working on the KDevelop IDE.
|
Registered Member
|
Thank you for your reply! I had to register again because I couldn't login with my user name. The site tells me the user name is not recognized. If my user name is not serendipity, then I have absolutely no idea what it is. It's no my email address that much I know. When trying to make a new account, the system recognized my email address and informed me the email was already in use. So I had to use a new email too. Anyway, the problem happens when I try to define a function in the class. This is a newly created project from the graphical application template. I hit compile and it does so fine. When I add the quit() definition the problem occurs.
Here's the compiler output:
Thank you very much. |
Global Moderator
|
|
Registered Member
|
No, I haven't touched it. The only thing I've done after creating the project is define quit(), nothing else. This is testGUI.cpp's contents:
|
Global Moderator
|
That was a suggestive question. You need to implement the method, that's what the linker tells you.
Maybe you should read up on some C++ stuff first -- this forum is not really suitable to guide you through a tutorial.
I'm working on the KDevelop IDE.
|
Registered Member
|
Excuse me but since when defining anything in c++ requires a declaration? I tried it anyway, as ridiculous as the idea seemed, thinking this might be a QT thing; got the same error. At this point I'm gonna continue compiling manually and using Kate. |
Global Moderator
|
That will not help with this error.
You're right, this is indeed a special case here. Since you declare the function as a slot, it is invoked in the .moc file in order to make it "dynamically callable" or whatever you want to call it, through the Qt Meta Object system. So all slots always need a definition as well. Apologies, this would have been hard to know for you. Why it still does not work I cannot tell without seeing the code. Greetings, Sven
I'm working on the KDevelop IDE.
|
Registered users: abc72656, Bing [Bot], daret, Google [Bot], lockheed, Sogou [Bot], Yahoo [Bot]