Page 1 of 1

Developing with Windows 10, Visual Studio 15

Posted: Thu Feb 25, 2016 2:35 am
by subquantic
Hello. I am attempting to program with the OpenSim C++ API, but there are some problems.

In order to begin compiling, I followed the instructions here:
http://simtk-confluence.stanford.edu:80 ... ep+Example

Using Windows 10, CMake 3.4.3 and Visual Studio 15 I had to make some adjustments in order to compile the TugOfWar1_CreateModel.cpp model. Namely:
* I generated the solution file with Visual Studio 14 2015 as my generator.
* I removed the definitions for the 'signbit' and 'timespec' objects.
* Downloaded a SimTKlapack.lib which seemed to be missing in my OpenSim library.

This allowed me to successfully compile. However, when following the next tutorial, e.g.
http://simtk-confluence.stanford.edu:80 ... n+Part+One
I ran into some trouble. Basically, after I add the block and the joint elements I can still compile the program, but running the executable causes errors:
Unhandled exception at 0x00007FF95CF9E71C (ntdll.dll) in exampleMain.exe: 0xC0000374: A heap has been corrupted (parameters: 0x00007FF95CFF22B0).
I haven't been able to figure what's the problem, and any insights would be appreciated.

Re: Developing with Windows 10, Visual Studio 15

Posted: Tue Mar 01, 2016 11:29 am
by aymanh
Sergio,

The "signbit" issue you mentioned was specific to version 3.2 and is fixed in version 3.3 which was released/built using VisualStudio 2015. What version of the source are you using and where did you download it from?

Thanks,
-Ayman

Re: Developing with Windows 10, Visual Studio 15

Posted: Wed Mar 02, 2016 11:56 pm
by subquantic
Thanks for the reply. I did not mention that I was building OpenSim 3.1 (downloaded from this site), so I could work with a particular project (https://simtk.org/home/upexdyn).

After some time I realized that I should be building Simbody from source. After some more time I decided that building 3.1 from source with Windows 10 and Visual Studio 15 would be tricky, so I decided to try something else. I attempted to compile Simbody and OpenSim from source using two configurations:

The first configuration used Windows 8.1, CMake 3.4.3, and VS Express 2010 to compile SimBody 3.1 and OpenSim 3.1 .
The second configuration used Windows 10, CMake 3.4.3, and VS 14 2015 to compile Simbody 3.5.3 and OpenSim 3.3 .

I was able to successfully compile and test the programs for both cases without any gimmicks like the 'signbit' thing.

Next I tried once more the API tutorial: http://simtk-confluence.stanford.edu:80 ... n+Part+One .

I got an error when compiling the example that only creates the OpenSim model. It was the same error for both of my builds:
LINK : fatal error LNK1104: cannot open file 'OpenSim_SimTKcommon.lib'
I noticed that I have the file ../sdk/lib/SimTKcommon.lib, but not OpenSim_SimTKcommon.lib . I seem to recall that I did everything using the "RelWidthDebInfo" and "x64" settings in Visual Studio. Does anyone see what might be causing this error?

Re: Developing with Windows 10, Visual Studio 15

Posted: Thu Mar 03, 2016 10:41 am
by chrisdembia
When we build OpenSim and Simbody for distribution, we set a Simbody CMake variable called `BUILD_USING_NAMESPACE` to `OpenSim_` to avoid conflicts with other Simbody libraries you may have.

Simply rename `SimTKcommon.lib` etc to `OpenSim_SimTKcommon.lib`, or rebuild Simbody with `BUILD_USING_NAMESPACE` set to `OpenSim_`.

EDIT: The namespace should be `OpenSim`, not `OpenSim_`.

Re: Developing with Windows 10, Visual Studio 15

Posted: Thu Mar 03, 2016 10:50 pm
by subquantic
Thanks!
Prepending 'OpenSim_" to the SimTK* files solved the problem.