Hello,
Previously, I have written code for the simulation of bipedal walking using Opensim API in C++ in windows (VS), and it works well.
I wanted to use our campus supercomputer (linux based) to run my codes.
I built simbody and opensim from source on it. Based on the instructions in following page for linux
http://simtk-confluence.stanford.edu:80 ... rom+Source
I turned off SIMBODY_STANDARD_11 and OPENSIM_STANDARD_11 when Simbody and Opensim.
Now when I'm compiling my codes, I get error: my codes needs c++11 features. I have used c++11 features in my own codes. My codes are really long, and I couldn't detect and remove all the c++ features, I have used.
Hence, I used "add_definitions(-std=c++11)" in my cmake file, and I could compile my codes. But now when I run the executable file I have generated, I receive segmentation error. I traced back and the error is somewhere in the Simbody package I have built.
Now please help me with this situation.
I also tried to use Open Science Grid, I could build simple opensim c++ programs and run on several cores, but when I try to build my own codes I receive similar errors as above. I believe the simbody and opensim on OpenScienceGrid server are installed without enabling c++11 standard.
Thanks a lot in advance.
SIMBODY_STANDARD_11/OPENSIM_STANDARD_11
- Mohammadhossein Saadatzi
- Posts: 5
- Joined: Sun Jan 18, 2015 7:35 pm
- Dimitar Stanev
- Posts: 1096
- Joined: Fri Jan 31, 2014 5:14 am
Re: SIMBODY_STANDARD_11/OPENSIM_STANDARD_11
add_definitions is the wrong way. You need to change the flags of the compiler. Why don't you want to build with c++11, do they support the new compiler?
or just
Code: Select all
# c++11
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR
"${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
# Using C++11 on OSX requires using libc++ instead of libstd++.
# libc++ is an implementation of the C++ standard library for OSX.
if(APPLE)
if(XCODE)
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
endif()
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
endif()
Code: Select all
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
- Mohammadhossein Saadatzi
- Posts: 5
- Joined: Sun Jan 18, 2015 7:35 pm
Re: SIMBODY_STANDARD_11/OPENSIM_STANDARD_11
Thank you Dimitar.
I didn't want to use c++11, because in the instructions for buildin on linux, it was mentioned that I would receive mysterious errors later.
Is there any way that I use c++11 just for my codes and not for opensim and simbody dependencies?
By the way, if I want to use opensim on OpenScienceGrid, I can not change the installation of opensim on it. Am I right?
I didn't want to use c++11, because in the instructions for buildin on linux, it was mentioned that I would receive mysterious errors later.
Is there any way that I use c++11 just for my codes and not for opensim and simbody dependencies?
By the way, if I want to use opensim on OpenScienceGrid, I can not change the installation of opensim on it. Am I right?
- Christopher Dembia
- Posts: 506
- Joined: Fri Oct 12, 2012 4:09 pm
Re: SIMBODY_STANDARD_11/OPENSIM_STANDARD_11
It is possible to use SIMBODY_STANDARD_11=on and OPENSIM_STANDARD_11=on. Then you can use C++11 in your own code.