Using MEX compiler options "-Dname=value"
Ältere Kommentare anzeigen
Hi,
I am trying to compile a mex cpp function which I need to define a preprocessor symbol (i.e. mex -DXX="I AM A STRING" xxx.cpp), but I cannot figure out how to get the value to be sent to the actual compiler as a string. I am running Matlab R2009b on Solaris. I am using (all of which do not work):
mex('-f',mymexoptsfile,sprintf('-DXX=%s',valueName));
mex('-f',mymexoptsfile,sprintf('-DXX="%s"',valueName));
mex('-f',mymexoptsfile,sprintf('-D''XX="%s"''',valueName));
Thank you. Jordan
Akzeptierte Antwort
Weitere Antworten (2)
Kaustubha Govind
am 5 Aug. 2011
0 Stimmen
See Override Option Details in the documentation for the MEX command. This is how you should specify custom compiler/linker flags.
Jordan
am 5 Aug. 2011
Kategorien
Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!