Dear users,
I am attempting to run the Matlab script files provided by the following project: https://simtk.org/projects/datatracking .
I am able to successfully run the scripts up to the point at which a Mex function call is made to a .cpp file. I then receive the following error message from Matlab:
Error using mex
calcStateDerivsMetaPowerFGContactF_Thelen2003Muscle_Subj1PTSR.cpp
\\myfiles\nh546\Profiles_Do_Not_Delete\campus\Desktop\DataTracking_Ver1\Models\calcStateDerivsMetaPowerFGContactF_Thelen2003Muscle_Subj1PTSR.cpp(2)
: fatal error C1083: Cannot open include file: 'OpenSim/OpenSim.h': No such file or directory
Error in RunDataTracking (line 94)
eval(['mex ',mexfilename,' -L''c:\OpenSim3.3\sdk\lib\'' -LosimCommon -LosimSimulation -LosimAnalyses
-LosimActuators -LosimTools -LOpenSim_SimTKcommon -LOpenSim_SimTKmath -LOpenSim_SimTKsimbody
-LosimJavaJNI -LosimLepton -LosimSimmFileWriter -I''c:\OpenSim3.3\sdk\include''
-I''C:/OpenSim3.3/sdk/include/SimTK/include'' -DWIN32 -D_WINDOWS -DNDEBUG'])
I have done some investigating and it appears as though if I provide the absolute file path location to the OpenSim.h file location then it works, but then seems to provide another identical error message for another instance at which another header file cannot be located.
Is there a way in which I can tell Matlab of the relevant location of these header files? Or alternatively do I need to edit something within the .cpp file?
I have attached the .cpp file.
Kind regards,
Nicos Haralabidis
Cannot open include file: 'OpenSim/OpenSim.h'
- Nicos Haralabidis
- Posts: 196
- Joined: Tue Aug 16, 2016 1:46 am
Cannot open include file: 'OpenSim/OpenSim.h'
- Attachments
-
- calcStateDerivsMetaPowerFGContactF_Thelen2003Muscle_Subj1PTSR.cpp
- (6.39 KiB) Downloaded 71 times
Tags:
Re: Cannot open include file: 'OpenSim/OpenSim.h'
Hi Nicos,
I may have had a similar problem to you recently (I can't remember the exact error message but I was getting stuck at a similar point in the RunDataTracking.m file) and it was due to the file path to the sdk library being slightly different. I have OpenSim installed in "OpenSim 3.3" (note the space in comparison to what's in the original script). If this is the same as your case you firstly need to add the space to the filepath, but then remove the last backslash from the file path too (i.e. if there are spaces in the file path then this slash causes errors).
If that's not the problem then I don't have another solution!
Aaron
I may have had a similar problem to you recently (I can't remember the exact error message but I was getting stuck at a similar point in the RunDataTracking.m file) and it was due to the file path to the sdk library being slightly different. I have OpenSim installed in "OpenSim 3.3" (note the space in comparison to what's in the original script). If this is the same as your case you firstly need to add the space to the filepath, but then remove the last backslash from the file path too (i.e. if there are spaces in the file path then this slash causes errors).
If that's not the problem then I don't have another solution!
Aaron
- Nicos Haralabidis
- Posts: 196
- Joined: Tue Aug 16, 2016 1:46 am
Re: Cannot open include file: 'OpenSim/OpenSim.h'
Good morning Aaron,
Thank you for your prompt reply! I modified the file paths as per your suggestion and it runs past that point now successfully. Thanks for your help.
Kind regards,
Nicos Haralabidis
Thank you for your prompt reply! I modified the file paths as per your suggestion and it runs past that point now successfully. Thanks for your help.
Kind regards,
Nicos Haralabidis
- Karthick Ganesan
- Posts: 119
- Joined: Thu Oct 10, 2013 12:11 am
Re: Cannot open include file: 'OpenSim/OpenSim.h'
Dear Nicos and Aaron,
I am also trying to run the same code. I got the following error message.
Invalid MEX-file
'F:\Research\OpenSimS\DataTracking-latest\DataTracking_Ver1\DataTracking_Ver1\Models\calcStateDerivsMetaPowerFGContactF.mexw64':
A dynamic link library (DLL) initialization routine failed.
Do you have any suggestions on this? Which version of visual studio did you use? Any help on this would be appreciated.
\
I am also trying to run the same code. I got the following error message.
Invalid MEX-file
'F:\Research\OpenSimS\DataTracking-latest\DataTracking_Ver1\DataTracking_Ver1\Models\calcStateDerivsMetaPowerFGContactF.mexw64':
A dynamic link library (DLL) initialization routine failed.
Do you have any suggestions on this? Which version of visual studio did you use? Any help on this would be appreciated.
\
- Nicos Haralabidis
- Posts: 196
- Joined: Tue Aug 16, 2016 1:46 am
Re: Cannot open include file: 'OpenSim/OpenSim.h'
Good morning Karthick,
I managed to compile the Mex function directly through Matlab using VS 2015. Make sure you follow the suggestion made by Aaron - 'OpenSim3.3' may need to be modified to 'OpenSim 3.3' when linking the libraries.
Have you modified the Model filename path in the *.cpp file to match with the location of your Model file?
Kind regards,
Nicos Haralabidis
I managed to compile the Mex function directly through Matlab using VS 2015. Make sure you follow the suggestion made by Aaron - 'OpenSim3.3' may need to be modified to 'OpenSim 3.3' when linking the libraries.
Have you modified the Model filename path in the *.cpp file to match with the location of your Model file?
Kind regards,
Nicos Haralabidis
- Karthick Ganesan
- Posts: 119
- Joined: Thu Oct 10, 2013 12:11 am
Re: Cannot open include file: 'OpenSim/OpenSim.h'
Dear Nicos,
Thank you very much for your prompt reply. I also encountered the same issue earlier and modified the OpenSim Install directory. I changed the model name in the cpp code. Still I get the same error. I tried with VS 2015 (enterprise). But Matlab did not recognize it for compiling MEX file. Hence I used Visual Studio 2010.
Thank you very much for your prompt reply. I also encountered the same issue earlier and modified the OpenSim Install directory. I changed the model name in the cpp code. Still I get the same error. I tried with VS 2015 (enterprise). But Matlab did not recognize it for compiling MEX file. Hence I used Visual Studio 2010.
- Nicos Haralabidis
- Posts: 196
- Joined: Tue Aug 16, 2016 1:46 am
Re: Cannot open include file: 'OpenSim/OpenSim.h'
Hello Karthick,
Can you successfully compile a very basic Mex function through Matlab using your compiler? What command(s) are you using to attempt to compile the function?
Kind regards,
Nicos Haralabidis
Can you successfully compile a very basic Mex function through Matlab using your compiler? What command(s) are you using to attempt to compile the function?
Kind regards,
Nicos Haralabidis
- Karthick Ganesan
- Posts: 119
- Joined: Thu Oct 10, 2013 12:11 am
Re: Cannot open include file: 'OpenSim/OpenSim.h'
I could compile the example in matlab documentation with VS2010. Even for the data tracking code, the mex file was compiled successfully with VS 2010. But when it was called by the objective function I get this error message.