Using MEX compiler options "-Dname=value"
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (2)
Kaustubha Govind
le 5 Août 2011
0 votes
See Override Option Details in the documentation for the MEX command. This is how you should specify custom compiler/linker flags.
Jordan
le 5 Août 2011
Catégories
En savoir plus sur Write C Functions Callable from MATLAB (MEX Files) dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!