6

Simple question: I have a C++ project configured for a existing makefile and it compiles fine. However, the IDE keeps complaining that it cannot resolve most of my symbols.

How do I configure eclipse to use my includes?

3 Answers 3

9

Project->properties->C/C++ General->Paths and Symbol

Add the path to your include directory.

You can see in the screenshot, the configuration I use to develop with Qt in C++.

Screenshot representing Eclipse configuration for Qt Headers

2
  • I did that and it didn't work, because I'm not using the compilers listed there (setting the paths won't solve it). Eclipse compiles my project through the makefile and I don't know what the hell it does to find out about my project's errors lol
    – ivarec
    Commented Dec 12, 2011 at 21:20
  • It was solving using absolute PATHs instead of Workspace ones. Thanks!
    – ivarec
    Commented Dec 12, 2011 at 21:24
3

I added my includes in the paths and symbols, but they are not added during qt compilation. For compilation, qt uses these includes and ignores what I've added:

g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -Idebug -I. -o debug/bp.o bp.cpp
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -Idebug -I. -o debug/Navigation.o Navigation.cpp
Navigation.cpp:16:22: error: XnOpenNI.h: No such file or directory
Navigation.cpp:17:26: error: XnCppWrapper.h: No such file or directory
Navigation.cpp:18:20: error: XnHash.h: No such file or directory
Navigation.cpp:19:19: error: XnLog.h: No such file or directory
Navigation.cpp:22:16: error: cv.h: No such file or directory
Navigation.cpp:23:18: error: cv.hpp: No such file or directory

I found the answer here: QT Eclipse Integration - Adding External Libs

It seems that this is a kind of conflict between the CDT and Qt builder, so even if you add the options in CDT as in the screenshot above, the compiler doesn't find them!

You need to add them in the xxx.pro file as this: http://doc.qt.digia.com/4.5/qmake-variable-reference.html#includepath

1
  • 1
    Thanks! I've switched to Emacs, though, and I'm not looking back. :)
    – ivarec
    Commented Oct 20, 2012 at 21:53
1

I had the same problem when I imported an existing Makefile project with:

File -> New -> Makefile Project with Existing Code

If you don't want to configure anything and just want eclipse to recognize all Paths from your existing (working) Makefile on it's own just do the following:

  • right click on your project -> Clean Project
  • right click on your project -> Build Project

The Eclipse Indexer then recognizes all paths on it's own without needing any additional configuration. You just need Eclipse to execute your imported Makefile and everything is resolved (if your Makefile works properly outside Eclipse).

Tested in:

Eclipse IDE for C/C++ Developers
Version: Luna Service Release 2 (4.4.2)
Build id: 20150219-0600

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.