[ODE] Newbie: gcc apparently not finding libode.a

Micheál O'Brien mobrien at europe.com
Thu Dec 12 15:19:01 2002


I tried compiling it too and got the same errors. The problem is that -lode 
needs to go after main.c on the command line. 
 
Both of the following work. 
 
g++ -oodetest main.c -lode 
gcc -oodetest main.c -lode -lm -lstdc++ 
 
Good luck, 
Micheál 
 
> Hello everyone, 
>  
> I'm having a problem creating an application using ODE. I have 
succesfully 
> configured and compiled lib-ode. I've copied libode.a to 
/usr/lib/libode.a 
> (I'm using Mandrake 8.2 on x86). The include files are copied to 
> /usr/include/ode, and they work well. I wrote this small test file to see 
if 
> the library was working: 
>  
> /* main.c */ 
> #include <stdio.h> 
> #include <stdlib.h> 
> #include <string.h> 
> #include <ode/ode.h> 
>  
> int main(int argc, char* args[]) 
> { 
>         // create world 
>         dWorldID world; 
>         dWorldSetERP (world, 0.01); 
>  
>         return 0; 
> } 
>  
> I compile it using the command: 
> gcc -L/usr/lib/ -lode -oodetest main.c 
>  
> I've tried about everything with the -l and -L switches, but I keep 
getting 
> the following error: 
> /tmp/ccUXVR2r.o: In function `main': 
> /tmp/ccUXVR2r.o(.text+0x17): undefined reference to `dWorldSetERP' 
> collect2: ld returned 1 exit status 
>