Author Topic: QT and C::B problem - header files not found  (Read 11252 times)

Piotr

  • Guest
QT and C::B problem - header files not found
« on: March 30, 2006, 12:45:11 pm »
Hi,
There is a slight problem with Code::blocks recognizing directories of QT. First, I have Installed c::b 1.0rc2 and QT 4.1.1, and when trying to build a project with a <QApplication> header, the compiler cannor find it. In build options of the projects all QT subfolders, like C:\Qt\4.1.1\include\QTGui, are listed. Apparently, c::b can see only the C:\Qt\4.1.1\include\QT folder, which does not contain <QApplication> file but <QApplication.h>.
I have searched for this bug a little and found that someone already reported it:
http://forums.codeblocks.org/index.php?topic=2250.0
It is not the "Debug library not built" problem, as someone suggests, since the libraries are linked, and the problem occurs already at the compilation time.
I have removed rc2 and installed latest night build + MinGW 5.0.2, but no improvement.

yop plugin, well... I couldn't even build it. The IDE moans for defining two variables: cb and wx, which I could not even delete, as the annoying dialog returned each time I clicked Delete and OK, and I could do nothing but kill the Code::Blocks process! I suggest to improve this feature, as users should not get stuck with a modal dialog box and even be not able to close the application.

Can anyone check the way the include directories are refered in C::B?

King regards,

Piotr

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: QT and C::B problem - header files not found
« Reply #1 on: March 30, 2006, 01:09:21 pm »
Hello,

There is a slight problem with Code::blocks recognizing directories of QT. First, I have Installed c::b 1.0rc2

Use a nightly build instead of RC2.

yop plugin, well... I couldn't even build it. The IDE moans for defining two variables: cb and wx, which I could not even delete, as the annoying dialog returned each time I clicked Delete and OK, and I could do nothing but kill the Code::Blocks process! I suggest to improve this feature, as users should not get stuck with a modal dialog box and even be not able to close the application.

cb and wx are global variables. cb points to the C::B sources and wx to wxWidgets. For example, in my case:

wx-->C:\temp\wxWidgets-2.6.3
cb-->C:\Programme\DANAE\CodeBlocks\CodeBlocks\src

Check if they are correctly defined under Settings-->Global variables.

Best wishes,
Michael

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: QT and C::B problem - header files not found
« Reply #2 on: March 30, 2006, 01:23:36 pm »
Use a nightly build instead of RC2.

I have removed rc2 and installed latest night build + MinGW 5.0.2, but no improvement.

Piotr

  • Guest
Re: QT and C::B problem - header files not found
« Reply #3 on: March 30, 2006, 01:26:19 pm »
Hello Michael, thanks for reply

Hello,

There is a slight problem with Code::blocks recognizing directories of QT. First, I have Installed c::b 1.0rc2

Use a nightly build instead of RC2.


I did, mentioned this later in my post.

yop plugin, well... I couldn't even build it. The IDE moans for defining two variables: cb and wx, which I could not even delete, as the annoying dialog returned each time I clicked Delete and OK, and I could do nothing but kill the Code::Blocks process! I suggest to improve this feature, as users should not get stuck with a modal dialog box and even be not able to close the application.

Quote
cb and wx are global variables. cb points to the C::B sources and wx to wxWidgets. For example, in my case:

wx-->C:\temp\wxWidgets-2.6.3
cb-->C:\Programme\DANAE\CodeBlocks\CodeBlocks\src

Check if they are correctly defined under Settings-->Global variables.


I do not have wxWindows sources. Does it mean I cannot build this plugin?
Anticipating your answer :), please, do not ask me to get wx so to be able to create QT applications...

Is it necessary that Code::Blocks relies on 3rd party plugin to facilitate QT applications development?

Piotr

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: QT and C::B problem - header files not found
« Reply #4 on: March 30, 2006, 02:02:29 pm »
I did, mentioned this later in my post.

Sorry :oops:. I did read too fast.

I do not have wxWindows sources. Does it mean I cannot build this plugin?
Anticipating your answer :), please, do not ask me to get wx so to be able to create QT applications...

What I did was to download and build wxWidgets and put its path to the wx global variable. IMHO you should need wxWidgets to build the QT plugin. Then to develop Qt applications you will need it no more.

Is it necessary that Code::Blocks relies on 3rd party plugin to facilitate QT applications development?

Well, if the Qt plugins was part of the contr. plugins then you will not need to build it. But as it is not....Anyway I think that yop could give you more info.

Some useful (I hope :)) info can be found here, here and here.

Best wishes,
Michael

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: QT and C::B problem - header files not found
« Reply #5 on: March 30, 2006, 02:36:55 pm »
For now you will need to have the means to build a Code::Blocks plugin in order to build my plugin. It's like saying that you want to build a plugin for QtFoo application without having Qt and QtFoo's SDK installed, it's just impossible. I do plan on releasing the plugin in binary form but that is can only happen with the next C::B release as it would just become useless after a few night-builds. I have worked on it quite a lot (though not so much in the last 15 days) and  it's pretty useable (I built a large proprietary project from work without any problems). For now AFAIK C::B with the plugin are the only opensource tools for Qt development under windows.
Thanks for trying (to try :)) the plugin out,
Yorgos
Life would be so much easier if we could just look at the source code.

Piotr

  • Guest
Re: QT and C::B problem - header files not found
« Reply #6 on: March 30, 2006, 03:46:43 pm »
In the meantime I have found this thread:

http://forums.codeblocks.org/index.php/topic,615.0.html

I followed this solution (simplified slightly) and it works :)

To summarize it, first one needs to add pre-build commands":
qmake - project
qmake

and run the project (There still will be errors)
Then in project properties check the makefile option and run again.

Anyway, the build options should be improved. It looks like this problem has nothing to do with QT itself, but rather path settings. As I mentioned, include paths were visible in the list, but except for $QTDIR\include\Qt they have not effect. This is a little confusing.

I look forward to next official RC. The nightly builds come without mingw and I do like to have everything installed after single button-click :)

Thanks for prompt replies. Code::blocks in nice anyway :)

Piotr

Piotr

  • Guest
Re: QT and C::B problem - header files not found
« Reply #7 on: March 31, 2006, 12:38:32 am »
I would like to add 2 things
1. The path settings for QT template are wrong: instead of \include\QT\QTGui or \include\QT\QTCore should be \include\QTGui and \include\QTCore.
2. With these paths corrected, the official release is able to find all header files, these without .h extension as well.
On the other hand, the latest nightly build can't find ANY header file for QT project, even those with good old .h extension.

Piotr

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: QT and C::B problem - header files not found
« Reply #8 on: March 31, 2006, 11:11:03 am »
Finding the correct path to the Qt headers is the least of the problems when building a Qt project. Meta compilation is the major issue.
Life would be so much easier if we could just look at the source code.

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: QT and C::B problem - header files not found
« Reply #9 on: March 31, 2006, 11:18:41 am »
Meta compilation is the major issue.

Would not be possible to use some kind of pre-build step in C::B for meta-compilation?

Best wishes,
Michael

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: QT and C::B problem - header files not found
« Reply #10 on: March 31, 2006, 11:41:26 am »
Meta compilation is the major issue.

Would not be possible to use some kind of pre-build step in C::B for meta-compilation?

Best wishes,
Michael


I 'm sure it is.

Yop, have you tried changing the build command for each .ui file? I 'm talking about right-clicking on a .ui file and selecting "Properties". Yes, it would be a manual procedure for every .ui file you add to the project but maybe it would work and take full advantage of the existing build system...
Be patient!
This bug will be fixed soon...

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: QT and C::B problem - header files not found
« Reply #11 on: March 31, 2006, 12:03:54 pm »
It's not only that I'm afraid, it's also header files that contain the Q_OBJECT macro that must pass through the meta object compiler generating some indermediate code in a different .cpp file that must also participate in the build process. Exactly the things you suggest were my thoughts back in beta 4 (or 5? it was the same time you won that gfx card and I noticed your signature ;)) but I didn't have any luck with it. I 'll give it another try as it seems a cleaner solution (and the feature requests for Qt support keep coming in).
Life would be so much easier if we could just look at the source code.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: QT and C::B problem - header files not found
« Reply #12 on: March 31, 2006, 12:08:23 pm »
I 'll give it another try as it seems a cleaner solution (and the feature requests for Qt support keep coming in).

Well, don't sweat over this too much. The new compiler definition framework is planned before the next release so it would then be possible to support QT natively :)

EDIT: If I remember well, back from my QT days, moc (for headers) and uic (for .ui files) are the only extra needed programs/steps. Right?
« Last Edit: March 31, 2006, 12:10:24 pm by mandrav »
Be patient!
This bug will be fixed soon...

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: QT and C::B problem - header files not found
« Reply #13 on: March 31, 2006, 12:19:23 pm »
It's not only that I'm afraid, it's also header files that contain the Q_OBJECT macro that must pass through the meta object compiler generating some indermediate code in a different .cpp file that must also participate in the build process. Exactly the things you suggest were my thoughts back in beta 4 (or 5? it was the same time you won that gfx card and I noticed your signature ;)) but I didn't have any luck with it. I 'll give it another try as it seems a cleaner solution (and the feature requests for Qt support keep coming in).

For my project, I use Qt and Visual Studio .NET 2003 (:roll:). With Qt 3 it was possible to integrate it into VS, but it is not necessary (even if comfortable :)). As alternative, it is possible is to use VS "Custom Build" for .ui and the files containing the macro Q_OBJECT. Then during the building, the required Qt tools were called. I am not sure, but may be such a custom build could be used within the pre-build step of C::B.

Best wishes,
Michael

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: QT and C::B problem - header files not found
« Reply #14 on: March 31, 2006, 12:36:21 pm »
Meta compilation is the major issue.

Would not be possible to use some kind of pre-build step in C::B for meta-compilation?

Best wishes,
Michael


I 'm sure it is.

Yop, have you tried changing the build command for each .ui file? I 'm talking about right-clicking on a .ui file and selecting "Properties". Yes, it would be a manual procedure for every .ui file you add to the project but maybe it would work and take full advantage of the existing build system...

I have had a look at file property. I would like to ask if under Properties-->Advanced tab the custom build needs to be related to a C::B compiler (e.g., GCC) or if an external tool can be called. Just for info, VS in its "Custom Build" has 4 parts: Command line, Description, Outputs and Additional Dependencies. This makes relatively easy to manage Qt special files.

Best wishes,
Michael