Using MEX compiler options "-Dname=value"
Mostra commenti meno recenti
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
Risposta accettata
Più risposte (2)
Kaustubha Govind
il 5 Ago 2011
0 voti
See Override Option Details in the documentation for the MEX command. This is how you should specify custom compiler/linker flags.
Jordan
il 5 Ago 2011
Categorie
Scopri di più su Write C Functions Callable from MATLAB (MEX Files) in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!