Filter löschen
Filter löschen

error: expected constructor, destructor, or type conversion before '(' token?

16 Ansichten (letzte 30 Tage)
margol
margol am 7 Jul. 2014
Beantwortet: Geoff Hayes am 8 Jul. 2014
I'm trying to compile a cpp file using mex (changeanalysis.cpp). I have Matlab R2012a, Xcode 4.6 on a MAC OS X 10.7. In the file changeanalysis.cpp, aef_global_dllexport.h is included. Some part of aef_global_dllexport.h is as follows:
////////////////////////
// DLL EXPORT FUNCTIONS
////////////////////////
#define DLLEXPORT _declspec(dllexport)
DLLEXPORT double maha_dist_3D_ex( double x,
double y,
double z,
double* mean,
double** icovm);
DLLEXPORT int matrix_inv_ND_ex( double** matND,
double& det,
int Dim);
DLLEXPORT int matrix_copy3x3_ex( double** x,
double** y);
.
.
.
When I compile the file changeanalysis.cpp, I get the following error message at the command prompt:
mex -I"/Users/marzi/Documents/MATLAB" changeanalysis.cpp
In file included from changeanalysis.cpp:58:
/Users/marzi/Documents/MATLAB/aef_global_dllexport.h:7: error: expected constructor, destructor, or type conversion before '(' token
/Users/marzi/Documents/MATLAB/aef_global_dllexport.h:13: error: expected constructor, destructor, or type conversion before '(' token
/Users/marzi/Documents/MATLAB/aef_global_dllexport.h:17: error: expected constructor, destructor, or type conversion before '(' token
/Users/marzi/Documents/MATLAB/aef_global_dllexport.h:20: error: expected constructor, destructor, or type conversion before '(' token
/Users/marzi/Documents/MATLAB/aef_global_dllexport.h:22: error: expected constructor, destructor, or type conversion before '(' token
/Users/marzi/Documents/MATLAB/aef_global_dllexport.h:24: error: expected constructor, destructor, or type conversion before '(' token
/Users/marzi/Documents/MATLAB/aef_global_dllexport.h:29: error: expected constructor, destructor, or type conversion before '(' token
/Users/marzi/Documents/MATLAB/aef_global_dllexport.h:31: error: expected constructor, destructor, or type conversion before '(' token
/Users/marzi/Documents/MATLAB/aef_global_dllexport.h:50: error: expected constructor, destructor, or type conversion before '(' token
/Users/marzi/Documents/MATLAB/aef_global_dllexport.h:75: error: expected constructor, destructor, or type conversion before '(' token /Users/marzi/Documents/MATLAB/aef_global_dllexport.h:100: error: expected constructor, destructor, or type conversion before '(' token
mex: compile of ' "changeanalysis.cpp"' failed.
Error using mex (line 206) Unable to complete successfully.
Does anyone know how to fix this or what is the cause of this error?
Thanks.

Antworten (1)

Geoff Hayes
Geoff Hayes am 8 Jul. 2014
Try including two underscores in front of declspec
#define DLLEXPORT __declspec(dllexport)

Kategorien

Mehr zu Call C++ from MATLAB finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by