I cannot include OpenSim.h in my mex file
Posted: Sun Jun 02, 2013 7:00 pm
Hi everyone,
I am trying to create a mex file so that I can call opensim functions from MatLab. My test.cpp file is as below:
I have changed the mexopts.bat file and included these two additional directories:
- C:\OpenSim2.4.0\sdk\include\SimTK\include
- C:\OpenSim2.4.0\sdk\include;
When I type mex test.cpp in MatLab command line, it returns these errors:
Thanks
Sina
p.s: I have attached the modified mexopts.bat file.
I am trying to create a mex file so that I can call opensim functions from MatLab. My test.cpp file is as below:
Code: Select all
#include "mex.h"
#include <OpenSim/OpenSim.h>
using namespace OpenSim;
using namespace SimTK;
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[] )
{
// Calculations
}
- C:\OpenSim2.4.0\sdk\include\SimTK\include
- C:\OpenSim2.4.0\sdk\include;
When I type mex test.cpp in MatLab command line, it returns these errors:
Any ideas how can I solve the problem?test.cpp
c:\opensim2.4.0\sdk\include\opensim\common\PropertySet.h(124) : warning C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
c:\opensim2.4.0\sdk\include\opensim\common\PropertySet.h(128) : warning C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
c:\opensim2.4.0\sdk\include\opensim\common\LoadOpenSimLibrary.h(50) : error C2146: syntax error : missing ';' before identifier 'WINAPI'
c:\opensim2.4.0\sdk\include\opensim\common\LoadOpenSimLibrary.h(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\opensim2.4.0\sdk\include\opensim\common\LoadOpenSimLibrary.h(50) : error C2146: syntax error : missing ';' before identifier 'LoadOpenSimLibrary'
c:\opensim2.4.0\sdk\include\opensim\common\LoadOpenSimLibrary.h(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\opensim2.4.0\sdk\include\opensim\common\LoadOpenSimLibrary.h(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\PROGRA~1\MATLAB\R2010A\BIN\MEX.PL: Error: Compile of 'test.cpp' failed.
??? Error using ==> mex at 222
Unable to complete successfully.
Error in ==> testMex at 8
mex test.cpp
Thanks
Sina
p.s: I have attached the modified mexopts.bat file.