Page 1 of 2
VC++ and OpenSim GUI with 4.0
Posted: Wed Oct 25, 2017 8:07 am
by hkimpara
Hello,
After install OpenSim 4.0, I had some conflicts with VS C++ and OpenSim GUI.
VS C++ cannot build any programs. The error are saying "cannot open source file "OpenSim/Actuators/osimActuatorsDLL.h" File:BodyActuator.h". Do I have something to change environmental variables for VS C++?
Also, I still use OpenSim v3.3 GUI. But when GUI read model file, a window indicates Error message as attached image.
![ErrorOpenSimGUI.png](./download/file.php?id=1656&sid=a05e24677748e1dc8621559301a937a4)
- ErrorOpenSimGUI.png (29.39 KiB) Viewed 374 times
Is there any solutions for OpenSim 4.0 users?
Thank you,
Hide
Re: VC++ and OpenSim GUI with 4.0
Posted: Wed Oct 25, 2017 9:40 am
by aymanh
Hi,
Can you explain your environment? OpenSim 3.3 has a public ditribution of GUI and needs env. var OPENSIM_HOME to be set to locate resouces. OpenSim 4.0 GUI has not been publicly released though there are some Alpha builds that we made available. OpenSim 4.0 GUI doesn't need OPENSIM_HOME setting.
Generally, models created or saved in OpenSim 4.0 (API) cannot be read in OpenSim 3.3 GUI as the file formats have changed. We maintain backward compatibility so that 4.0 can read 3.3 files but the reverse doesn't work.
As to the missing header file you indicated, please describe your environment and we'll help you resolve.
Hope this helps,
-Ayman
Re: VC++ and OpenSim GUI with 4.0
Posted: Wed Oct 25, 2017 10:59 am
by chrisdembia
I've gotten that error window with 3.3 and I've been able to just ignore it.
Re: VC++ and OpenSim GUI with 4.0
Posted: Wed Oct 25, 2017 11:08 am
by hkimpara
Hi Ayman and Christopher,
I was surprised that osim definition has been changed from 3.3 to 4.0. But I assume 4.0 can read and execute simulation using 3.3 defined osim model. Is it correct?
The GUI error feels uncomfortable to see the animation. Will it be cleared when 4.0 is officially released?
Also do you have any idea about VS C++ error?
I changed the headers as below, but VS C++ returns error.
Code: Select all
#include "C:\opensim-core\OpenSim\OpenSim.h"
#include "C:\opensim-core\sdk\Simbody\include\Simbody.h"
#include "C:\opensim-core\sdk\include\OpenSim\Simulation\Control\Controller.h"
#include "C:\opensim-core\sdk\include\OpenSim\Common\AbstractProperty.h"
Do you have any suggestions?
Thank you,
Hide
Re: VC++ and OpenSim GUI with 4.0
Posted: Wed Oct 25, 2017 11:18 am
by aymanh
Hide,
The error message is benign and can be ignored, or you can set OPENSIM_HOME env. variable to the top level directory of OpenSim 3.3 installation and the error will go away.
You normally do not specfy full path for headers in code, instead you specify the files relative tro some include folder, and have that folder specified in CMakeLists.txt or in Project settings in VS. How did you create the project in the first place? This may help us point you to a more sustainable way to compile/build the code. Also please indicate if using 3.3 ditribution or 4.0 from github.
Thanks,
-Ayman
Re: VC++ and OpenSim GUI with 4.0
Posted: Wed Oct 25, 2017 11:57 am
by hkimpara
Hello Ayman,
My Win 7 has OPENSIM_HOME directing "C:\OpenSim 3.3\bin" on User variables, and OpenSim_Dir directing "C:\OpenSim 3.3\bin" on System variables.
Even this case, I got same error when I open an osim model file.
EnvVariables.png
VS C++ programming:
When I checked CMAKE, I found "OPENSIM_INSTALL_DIR" was directing "c:\opensim 3.3\bin". However, even I changed it to new directory, VS C++ gives same error what I had.
Followings is a part of CMakeList.txt. I realized there are several environmental variables such as OpenSim_SOURCE_DIR, OPENSIM_HOME. In the aspect of programming, is it better the environmental variables of OPENSIM_HOME to new folder?
Code: Select all
###########################################
## For building with the rest of OpenSim ##
###########################################
cmake_minimum_required(VERSION 2.6)
# Define project
PROJECT (Centralized_Control_Workshop_Simple)
INCLUDE_DIRECTORIES(${OpenSim_SOURCE_DIR} ${OpenSim_SOURCE_DIR}/Vendors)
SET(OPENSIM_INSTALL_DIR $ENV{OPENSIM_HOME}
CACHE PATH "Top-level directory of OpenSim install")
# Change name of build target
SET(TARGET CentralizedController CACHE TYPE STRING)
# Identify the cpp file(s) that were to be built
FILE(GLOB SOURCE_FILES *.h *.cpp)
SET(SOURCE ${SOURCE_FILES})
....
Thank you,
Hide
Re: VC++ and OpenSim GUI with 4.0
Posted: Wed Oct 25, 2017 1:46 pm
by aymanh
Hide,
OPENSIM_HOME should NOT include bin at the end. Please set it to "C:\OpenSim 3.3" and retry. Same for OPENSIM_INSTALL_DIR
Please let us know how that goes,
-Ayman
Re: VC++ and OpenSim GUI with 4.0
Posted: Wed Oct 25, 2017 2:55 pm
by hkimpara
Hello Ayman,
Yes, changing OPENSIM_HOME to "C:\OpenSim 3.3" would solved GUI issue! Thank you.
But OPENSIM_INSTALL_DIR directing "C:\opensim-core" in CMake did not change so much.
Still I have error as this screen shot.
![C++Error.png](./download/file.php?id=1667&sid=a05e24677748e1dc8621559301a937a4)
- C++Error.png (96.97 KiB) Viewed 314 times
Do you have any ideas?
Thank you
Hide
Re: VC++ and OpenSim GUI with 4.0
Posted: Wed Oct 25, 2017 4:08 pm
by aymanh
Dear Hide,
Assuming you're using 4.0 from github (since otherwise the term opensim-core was never used), then you should at the end of building from source, run the INSTALL target. This will copy the libraries and headers from Simbody and OpenSim into a new layout similar to distributions. This defaults to opensim-core-install unless you change it in CMake. Please check your CMake screen (used to build opneims-core) and use the install directory (shown as CMAKE_INSTALL_PREFIX in CMake GUI) for OPENSIM_INSTALL_DIR when configuring your project then CMake will find the headers and the problem will be fixed.
Please let us kow how that goes.
-Ayman
Re: VC++ and OpenSim GUI with 4.0
Posted: Wed Oct 25, 2017 4:59 pm
by hkimpara
Hello Ayman,
Yes, I got 4.0 from github and built it from C:/opensim-core-source. Is there any installers for 4.0?
I followed the instruction on github. Therefore, the install directory is C:\opensim-core (I double-checked the CMAKE_INSTALL_PREFIX in CMake_GUI was C:\opensim-core).
In this environment, I addressed C:\opensim-core as the OPENSIM_INSTALL_DIR of my own project. Then, the headers were not recognized.
CMake screenshot of OpenSim 4.0 install
![CMake_OSim4_Install.png](./download/file.php?id=1671&sid=a05e24677748e1dc8621559301a937a4)
- CMake_OSim4_Install.png (112.69 KiB) Viewed 293 times
CMake screenshot of my project
![CMake_OwnProject.png](./download/file.php?id=1672&sid=a05e24677748e1dc8621559301a937a4)
- CMake_OwnProject.png (112.56 KiB) Viewed 293 times
Thank you and Best,
Hide