Registered Member
|
Hi. I'm very much a novice C++ programmer. I've never used an IDE before today, and I've never written a graphical application. I decided upon KDevelop because I'd like to try writing a Qt app for my KDE desktop. I know nothing about Qt yet, very little about KDevelop, and nothing at all about CMake or any other type of make utility. I mention all this in hopes that anyone who can help me will not presuppose that I know what I'm doing.
I wanted to try compiling a simple Qt graphical "Hello World" program. Using KAppTemplate, I chose the CMake Qt-C++ template to generate a CMake/Qt4 based GUI application. It appeared to generate properly. After importing it into KDevelop, I tried to build it. I got an error because of a missing moc file. I don't know what a moc file is, so I don't know how to fix it. KDevelop is version 4.3.1, using KDE Development Platform 4.8.5. My KDE version is 4.8.5.
So it seems that KDevelop runs make, which starts to generate the moc file, then encounters a parse error that halts the generation of the moc. Looking in the .cpp and .h files, I cannot see what the problem could be. This code is untouched by me; it is exactly as generated by KAppTemplate. This is the cpp file that includes the header file and the moc file.
This is the header file.
I don't find a moc file anywhere in the project build directory. There are some errors in the CMakeError.log file, but it doesn't refer to the moc, and the errors in it seem related to the Q_WS_WIN, Q_WS_QWS, and Q_WS_MAC, which were all listed in the build messages as "not found". Can anyone help me understand what the problem is, and how to fix it? |
Global Moderator
|
Hello!
The .moc files are generated by Qt's meta object compiler (moc). They are used by Qt for some things like signals and slots. Those files are generated at compile-time and are not (and should not be) included in the template. The error you have is the moc failing to generate the file (that's the
In any case I'd advise you to update to KDevelop 4.5 -- years of improvement have gone into it, including a new template engine which will quite certainly fix the issue you're facing This is also the reason there's probably no point to report a bug about this -- KDevelop 4.3 is old, and the component the error appears in has been replaced. To fix this particular instance of the problem, replace all the %{APPNAMEID} markers with your application name (e.g. "myapp") and recompile. Cheers, Sven
I'm working on the KDevelop IDE.
|
Registered Member
|
Sven, thank you very much. I replaced %{APPNAMEID} with the application name everywhere that it occurred, and now it builds successfully.
When I click the Execute button, it says "No valid executable specified", so there is still something wrong. But at least I got past the build error. I'll upgrade to 4.5 before I try anything else. |
Global Moderator
|
Good idea.
If it still fails after that, look at Run -> Configure launches. Probably you don't have a proper configuration there for launching your application. Cheers, Sven
I'm working on the KDevelop IDE.
|
Registered users: Bing [Bot], daret, Google [Bot], Sogou [Bot]