2

I have a mixed C++/Qt/Python project managed in Eclipse, and I would like to set the Qt paths without setting my project as a "Qt Project".

Using CDT and setting it as general "Makefile project from existing code", I cannot find any option in the project properties, where I can set the Qt paths. The menu "QT" seems to disappear from the project Properties if the project is set as other than "Qt Project".

I set the Qt include path (e.g. /include/QtGui/) in the "C++ General --> Paths & Symbols" option, but the includes (e.g. #include ) are still marked as "unresolved" by Eclipse.

Could you help me setting the Qt paths in the right way?

UPDATE

I ended up setting the project as "Qt GUI Project", then removing all files the Qt plugin created for me, and then adding all my C++ include paths in the build configuration.

It worked, but unfortunately the "Qt Gui Project" lacks of nice features you can find in the standard CDT "C++ project" as importing configurations from other projects, and so on...

so I still would like to hear from you, if you have hints to set a clean C++ project which makes use of Qt classes.

rmbianchi
  • 6,241
  • 6
  • 26
  • 27

3 Answers3

2

Well, the Qt include path you're supplying looks suspect to me. Do you really have a directory on your root called 'include'?? Most don't.

Also, usually QtGui is within the Qt include directory, where you've got others like QtCore and such.

But as far as settings in Eclipse go, you're on the right path.

Edward Strange
  • 40,307
  • 7
  • 73
  • 125
  • 1
    Hi Noah, thanks for your answer. Actually the right path is this one: "/..../external/qt/4.6.3/x86_64-slc5-gcc43-opt/include/", and under this "include" folder I find the QtGui/ QtCore/ and so on folders, as you said. But putting them (I tried the raw "include" and also the "include/QtGui") in Eclispe C++ Paths&Symbols configuration does not help. The "#include " and similars are still taken as "unresolved". Setting the project as "Qt Gui Project" fixes the problem with the Qt includes... but I don't find a way to fix it with the standard "C++" CDT project. – rmbianchi Nov 23 '10 at 18:38
1

You can do exactly you want by following my instructions here:

With this method you will not have to screw around with Eclipse include paths to QT headers or Eclipse library paths for QT binaries. Also, you will not have to rely on an outdated Eclipse integration plug-in, which I assume you are currently using.

Essentially, you set up a couple builders that invoke qmake. From that Eclipse is able to resolve the include paths and symbols and library binaries to link against in one (or two) clean steps.

  • Thanks! I'll try your instructions asap and I'll let you know. Thanks again. – rmbianchi May 14 '14 at 14:10
  • Did you give it a try, or do you have any other questions? I have been playing around a lot with Qt/Eclipse and I have made substantial observations/improvements on my original method. I could update my blog to disseminate some of this new information if would be helpful for you. –  Jun 30 '14 at 02:03
1

I gave Qt include path as /usr/include/qt4 and bin path as /usr/bin and it works fine

Jestin Joy
  • 3,711
  • 4
  • 19
  • 14