How to set QT paths in Eclipse without using the “Qt project”?

感情迁移 提交于 2020-01-04 06:58:08

问题


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.


回答1:


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.




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/4259365/how-to-set-qt-paths-in-eclipse-without-using-the-qt-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!