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
compiling on Linux with gcc
- Michael Sherman
- Posts: 807
- Joined: Fri Apr 01, 2005 6:05 pm
RE: compiling on Linux with gcc
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
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
- Katja Oberhofer
- Posts: 8
- Joined: Mon Feb 04, 2008 11:11 pm
RE: compiling on Linux with gcc
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
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
- Michael Sherman
- Posts: 807
- Joined: Fri Apr 01, 2005 6:05 pm
RE: compiling on Linux with gcc
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
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