Search code examples
c++shared-librarieseclipse-cdt

Eclipse CDT: how to import external libraries?


I am new at C++ and at eclipse. I am trying to use open dynamic engine. I am using ubuntu 12.04.2 LTS.

I downloaded ODE from sourceforge and compiled it using the instruction using make. At the end of the process, files libode.a and libode.la are present in usr/local/lib.

Demos delivered with the program run well.

I am now trying to use ODE with eclipse CDT (Juno Service Release 2).

I created a project and wrote this ultra-minimum program:

#include <ode/ode.h>
int main() {
    return 0;
}

First I did not change the properties of the project at all. But by default /usr/local/include is in the Includes and eclipse does not complain about not finding ode.h.

When I run the program I get 1057 errors of the like:

a was not declared in this scope | line 134,external location: /usr/local/include/ode/matrix.h

Looks like it is trying to recompile ODE ?

I wondered if it was because it could not find the libraries, and I edited the properties of the project. At the properties / c/c++ Build / settings / cross G++ Linker / Libraries I add "ode" at libraries and "/usr/local/lib" in Library search path.

This did not change anything.

Anything I do not get ?

---- Edit

Apparently eclipse is running:

g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/TestODE.d" -MT"src/TestODE.d" -o "src/TestODE.o" "../src/TestODE.cpp"

I ran this in terminal and get the same errors


Solution

  • Running make install is not the best way to install things on modern Linuxes. Try installing libode-dev package instead (sudo apt-get install libode-dev). Also, you should probably remove manually installed ODE beforehand.