Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: How to Mex a cpp file in Matlab
Replies: 3   Last Post: Apr 23, 2013 4:50 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Reza monfaredi

Posts: 2
Registered: 4/22/13
How to Mex a cpp file in Matlab
Posted: Apr 22, 2013 4:20 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi everybody,
I know how to make a Mex file for a simple CPP file. But when I want to compile a more complicated CPP program with included "header files" I keep getting strange errors. I should mention that when I was compiling the files directly in visual studio c++, it was okay and it successfully compiled. The header files that results in error are from a Phantom Omni Haptic device library and are correct. I also should mention that I set the correct compiler using mex -setup in Matlab.


Here is some part of the included header file and coresponding errors I got:

program:
((Included Header file name : hdDevices.h))

Line 25) #include <HD/hdExport.h>
Line 26) #include <HD/hdCompilerConfig.h>
Line 27) #include <HD/hdDefines.h>
Line 28)
Line 29) #ifdef __cplusplus
Line 30) extern "C" {
Line 31) #endif
Line 32)
Line 33) /* Initialize the device. Must be called before any use of the device.
Line 34) Makes the device current. */
Line 35) HDAPI HHD HDAPIENTRY hdInitDevice(HDstring pConfigName);
Line 36)
Line 37) /* Makes the specified device current: all future calls will be performed on
Line 38) this device. Requires a valid device id from an initialized device. */
Line 39) HDAPI void HDAPIENTRY hdMakeCurrentDevice(HHD hHD);
Line 40)

Errors ---->

C:\Program Files\MATLAB\R2012b\simulink\include\HD/hdDevice.h(35) : error C2146: syntax error : missing ';' before identifier 'HHD'

C:\Program Files\MATLAB\R2012b\simulink\include\HD/hdDevice.h(35) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

C:\Program Files\MATLAB\R2012b\simulink\include\HD/hdDevice.h(35) : error C2146: syntax error : missing ';' before identifier 'hdInitDevice'

C:\Program Files\MATLAB\R2012b\simulink\include\HD/hdDevice.h(35) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

C:\Program Files\MATLAB\R2012b\simulink\include\HD/hdDevice.h(39) : error C2144: syntax error : 'void' should be preceded by ';'

C:\Program Files\MATLAB\R2012b\simulink\include\HD/hdDevice.h(39) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

C:\Program Files\MATLAB\R2012b\simulink\include\HD/hdDevice.h(39) : error C2086: 'int HDAPI' : redefinition
.
.
.

Thanks
Reza




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.