Why does the MEX command not parse argument -D with '*' correctly?

I am using MEX with the '-D' flag to define the constant ELEMENT_OPERATOR and would like to define this constant to be *. When compiling a C++ mex file, I run the following command:
mex mexfun.cc -DELEMENT_TYPE=int64 -DELEMENT_OPERATOR=* -output times -v
but MATLAB errors out with the following message:
fatal error C1189: #error : ELEMENT_OPERATOR must be defined !
However, replacing '*' with '+' works fine.

 채택된 답변

The ability to pass "*" with the -D flag with the MEX command is not available in MATLAB 7.9 (R2009b).
This is because '*' is treated as a wildcard character in MEX script.
To work around the issue, you can add a macro
#define symbol *
line in the source code.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

제품

릴리스

R2009b

Community Treasure Hunt

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

Start Hunting!

Translated by