User forums > Help
Error compiling QT application
mandrav:
If you will be generating the makefile yourself (through qmake), you will also need to do two more things:
1) Set build method to "make" in global compiler options (you did that).
2) Go to "Project->Properties" and set the Makefile to be the generated makefile's name (relative to the project .cbp file) and check "This is a custom makefile" so C::B will use it as-is.
Yiannis.
Sputnik:
Well, I think I finally found the bug... it seems that the pre-build steps are only executed if you have "invoke compiler directly" as the build method; if not, these steps are simply ignored so the makefile is not created.
So, the process to build a QT app with makefiles is nowadays as follows (using Code::blocks QT project template):
1 - Go to QT app properties and check the "this is a custom makefile" checkbox.
Now click on project's build options button, select the default brach at left and, in commands area, type the following into pre-build-steps:
qmake -project
qmake
2 - Make sure you have selected "invoke compiler directly" as the build method in settings->compiler->other.
3 - Compile the project; if you have includes of type "#include <QtGui>" those won't be found, returning errors. The makefile is now created.
4 - Change again the build method, now it must be "Work with makefiles" and try to compile again; it must work now.
One final thing: QT creates two additional directories where it puts debug and release builds. In order to use the "run" button in Code::blocks to execute the built app, you have to change the directory where the executable is in "properties->targets->output filename".
rickg22:
So, the pre and post build steps don't work with makefiles? That sounds like a bug. Please report it at sourceforge.
Thanks :)
e-axis:
Good time.
I had the same problem and particularly solve it.
Compiler can’t find “#include <QtGui>” because it can’t find standard path to included file. In my case Qt Application set path “$QTDIR/include/Qt/QtGui” (look at Project->Build Option -/ Directories -/ Compiler) and the real path was “$QTDIR/include/QtGui”. And so for all.
The REAL problem is a linking.
Qt uses *.moc files, but how can I tell compiler to generate them, compile and link? :(
All hopes is to use Makefiles.
yop:
I I've used Codeblocks up to 1.0 beta 7 and then stuck to that version. Now I downloaded the RC 1-1 and wow!!! support for qt 4 open source edition. Since you see the post in this thread you realize that I have the same problems.
--- Quote from: Sputnik on July 29, 2005, 01:52:05 pm ---1 - Go to QT app properties and check the "this is a custom makefile" checkbox.
Now click on project's build options button, select the default brach at left and, in commands area, type the following into pre-build-steps:
qmake -project
qmake
2 - Make sure you have selected "invoke compiler directly" as the build method in settings->compiler->other.
3 - Compile the project; if you have includes of type "#include <QtGui>" those won't be found, returning errors. The makefile is now created.
4 - Change again the build method, now it must be "Work with makefiles" and try to compile again; it must work now.
--- End quote ---
I have solved the above issue by creating two tool entries in code blocks:
First:
Name : generate .pro file
Executable: C:\Qt\4.0.0\bin\qmake.exe (note must be full path)
Parameters: -project
Working Directory: ${PROJECT_DIR}
Second:
Same as above changing parameters field to -makefile and name to generate makefile.
The build method, should be "Work with makefiles" and in QT app properties the "this is a custom makefile" checkbox should be checked as quoted above. When you first build your project you should run the tools once (first the generate .pro file then generate makefile) and work as usual, you will only need to run the tools again if you for instance add new files etc.
The thing now is that doing the above we totally override CodeBlocks (we just use it as a fancy editor) and its a pity not being able to take advantage of all the features it provides.
--- Quote from: e-axis on August 16, 2005, 12:49:29 am ---Compiler can’t find “#include <QtGui>” because it can’t find standard path to included file. In my case Qt Application set path “$QTDIR/include/Qt/QtGui” (look at Project->Build Option -/ Directories -/ Compiler) and the real path was “$QTDIR/include/QtGui”. And so for all.
The REAL problem is a linking.
Qt uses *.moc files, but how can I tell compiler to generate them, compile and link? :(
All hopes is to use Makefiles.
--- End quote ---
e-axis you are 100% right. Firstly to the code::blocks team this problem with the folders should be looked into. Secondly qt generates "intermediate" files source files using the moc (meta object compiler). And if you are looking for the real qt experience you must also use the designer thus support .ui files etc. etc. I am navigating through the options I am given and I'll get back to you. In the mean time I will email to the qt mailing list I' m subscribed to, to suggest this beautiful IDE, believe it or not it's the only one to support Qt open source edition.
I will get back with this issue, as this IDE is a neccessesity to me...
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version