compiling on Linux with gcc

SimTKcore exists as a separate project to provide 'one stop shopping' for SimTK Core software and support, although the software is actually developed as a set of interdependent projects. SimTK 1.0 was released in March 2008, SimTK 2.0 in December, 2009.
POST REPLY
User avatar
Katja Oberhofer
Posts: 8
Joined: Mon Feb 04, 2008 11:11 pm

compiling on Linux with gcc

Post by Katja Oberhofer » Sun Feb 07, 2010 12:53 pm

Hello,

I installed the SimTK Core libraries on linux and AuxInstallCheck and CoreInstallCheck are working fine. However, I have problems compiling the example files using gcc compiler. My latest attempt was 'gcc -I/usr/local/SimTK/include -L/usr/local/SimTK/lib Pendulum.cpp -o Pendulum'. The compiler seems to find the .h files in the include/ folder but I get lots of error messages with undefined references to SimTK classes.

Has anyone used gcc with SimTK core libraries? Could you tell me how to properly add the include folder and lib folder to the compiler's path?

My apologies for asking a slightly 'off-topic' question but I hope someone can spare me more waisted hours. Many thanks! Any help is really appreciated.

Katja

User avatar
Michael Sherman
Posts: 807
Joined: Fri Apr 01, 2005 6:05 pm

RE: compiling on Linux with gcc

Post by Michael Sherman » Sun Feb 07, 2010 2:25 pm

Hi, Katja.

Your question is perfectly on topic for this forum!

You did everything right except you forgot to list the library names to link with. Just add '-lSimTKsimbody -lSimTKsimbody_aux' to the gcc line you used; there are more libraries but these top two should know where to find the rest. (The "aux" library is for the VTK visualization; the other one pulls in all the SimTK libraries.)

If that works, please feel free to answer similar questions that come up on the forum yourself. Otherwise, post again.

Regards,
Sherm

User avatar
Katja Oberhofer
Posts: 8
Joined: Mon Feb 04, 2008 11:11 pm

RE: compiling on Linux with gcc

Post by Katja Oberhofer » Mon Feb 08, 2010 8:04 pm

Hello Sherm,

Many thanks! I followed your advice and successfully compiled a few example files.

However, I have to add the library names which are linked to SimTKsimbody and SimTKsimbody_aux (more than 20 library files) to the command line. Is there a way to tell gcc to link with all library files in the SimTK/lib/ folder while compiling?

Anyway, I can finally start learning how to program with the Simbody toolkit. Great step forward ...

Regards,
Katja

User avatar
Michael Sherman
Posts: 807
Joined: Fri Apr 01, 2005 6:05 pm

RE: compiling on Linux with gcc

Post by Michael Sherman » Mon Feb 08, 2010 8:41 pm

Hi, Katja.

I'm not sure why you had to list all the libraries while I was able to get away with just listing those two. But in any case, the way to deal with this is to use a Makefile to do your builds. If you download the separate SimTK Core packages called "Example programs using SimTK" you will find that it includes a Makefile that you can modify. It already contains all the libraries that might be needed.

Regards,
Sherm

POST REPLY