Author Topic: Problem when compiling Qt3.3.3 app...  (Read 3536 times)

Offline Mage2k

  • Single posting newcomer
  • *
  • Posts: 7
Problem when compiling Qt3.3.3 app...
« on: October 08, 2005, 08:27:45 am »
Hi, I'm hoping one of you guys can help me out.  I'm trying to get Qt (3.3.3) apps building in C::B.  What I've done so far is to set the compiler to use makefiles under compiler settings, and added the following to the pre-build options for my project:

qmake -project
qmake

So, that gets executed ok and the Makefile is created by qmake.  However, when it begins compiling I get errors indicating that the various qt include files (e.g. qvbox.h, et...) don't exist.  I have verified that I can build the project with the created Makefile from the command line by directly invoking make and that the proper include directories are set under the projects compiler directories.  Any ideas?

Mage2k

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: Problem when compiling Qt3.3.3 app...
« Reply #1 on: October 08, 2005, 09:01:00 am »
If you 're using a custom makefile (i.e. not C::B generated), all C::B does is launch 'make -f <yourmakefile>'. No other setting in C::B takes effect.
You are using a custom makefile, yes?
You have checked "This is a custom makefile" in project properties, yes?
Be patient!
This bug will be fixed soon...

Offline Mage2k

  • Single posting newcomer
  • *
  • Posts: 7
Re: Problem when compiling Qt3.3.3 app...
« Reply #2 on: October 08, 2005, 10:31:28 am »
Well, given the two choices;

"This is a custom makefile":  in this case if none of the other settings in C::B takes effect, then qmake will not be run and no makefile will be generated.

Not using "This is a custom makefile":  in this case qmake is run and the Makefile is created and I get the above listed problem.

So, I've tried something else:

Change the qmake commands to

qmake -project
qmake "TARGET=default"

for ease of target use.

Unset the use custom makefile setting and build, I get the makefile built and the compile errors as noted previously.  Then I set the custom makefile setting and build, everything gets built, but the program doesn't actually run.  Then, when I choose Run again, C::B tells me the project hasn't been built and asks if I want to build it.  I say yes and it tells me that there is nothing to be done for default (the target).  I check, and yes, the app has been built, and I can run it from the terminal, but I can't run it from within C::B.

So, the problem here seems to be that I need a way to invoke qmake from within C::B in order to generate a the custom Makefile -- but, if I use a custom Makefile, then the pre-build commands don't get executed...

Also, if I don't use a custom makefile, am I to understand the C::B will generate one?  Where is it?  I certainly don't see it, the only one that is there is the one generated by qmake.

Mage2k
« Last Edit: October 08, 2005, 10:56:06 am by Mage2k »

Offline Mage2k

  • Single posting newcomer
  • *
  • Posts: 7
Re: Problem when compiling Qt3.3.3 app...
« Reply #3 on: October 08, 2005, 10:55:48 am »
Ok, I figured out why the errors are coming up when not using the custom makefile even though I have the correct directories specified via the system variable $QTDIR:  when g++ is run using makefiles (as opposed to directly), it chops off the first letter of QTDIR, i.e.:

g++    -ITDIR/include -I/usr/include -c lcdrange.cpp -o .objs/lcdrange.o

rather than

g++    -IQTDIR/include -I/usr/include -c lcdrange.cpp -o .objs/lcdrange.o

I can get around this by explicitly specifying the include dir in the build settings (although I still don't know how to be able to use qmake), but this seems like a bona-fide bug (note that this doesn't happen when invoking the compiler directly (not using make).  Should I report this or is it known?

Mage2k

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: Problem when compiling Qt3.3.3 app...
« Reply #4 on: October 08, 2005, 11:15:45 am »
If you don't specify your makefile as a custom makefile, then C::B will generate one on the fly (in your temporary directory). This means you makefile will not be used. I can see you 're in a dead-lock here in that you want C::B to run your pre-processing steps but still at the same time use a custom makefile. This is not possible, because the pre-processing steps are part of the generated makefile...
Please submit a feature request for this.
Be patient!
This bug will be fixed soon...

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: Problem when compiling Qt3.3.3 app...
« Reply #5 on: October 08, 2005, 11:58:22 am »
A simple work around would be to export your makefile and then use the generated makefile as a custom makefile. But as I can see you are trying to do something that I don't really get. The preprocessing steps you mentioned will generate two makefiles if codeblocks is set up to use makefiles, the first will be the qmake generated one wich will be build from the code blocks generated makefile that will actually build the project. In the above situation the qmake generated makefile won't participate in the make process. Am I missing something here?
When I started using codeblocks I used this workaround http://forums.codeblocks.org/index.php/topic,615.0.html (creating tools etc...) Another thing is that the QT Template supplied with codeblocks is so minimal that it can leed to wrong conclusions (like beeing able to build a super qt project based on that one as you can do with let's say the opengl template) but trolltech has so many custom features that need special handling that it's not just write code include headers provide libs and shoot, it's got many neccessery  :( preproccessing steps that trolltech has done a big effort (with qmake) to make them automatic.
Life would be so much easier if we could just look at the source code.

Offline Mage2k

  • Single posting newcomer
  • *
  • Posts: 7
Re: Problem when compiling Qt3.3.3 app...
« Reply #6 on: October 09, 2005, 08:09:39 am »
Yop, thanks for your response and tip about using the tools to run qmake, that worked perfectly.  What I was doing before was pretty much the same as Sputnik's solution (listed earlier in the trhead you linked) with the only difference being that I was flipping the "Use custome Makefile" setting rather than "Use makefiles/Invoke compiler directly" setting to invoke the prebuild steps.  But, moving the qmake invocations into tools to be run before building makes more sense and works much more cleanly.