How do you get MATLAB Coder to use -c99 rather than -ansi?

2 visualizzazioni (ultimi 30 giorni)
I have a function that I am trying to convert to MEX using Matlab Coder. This function has a call to coder.ceval(), which uses an external function which needs to be compiled using -c99 rather than -ansi. However, the build fails, and the build log says it is using -ansi. How do I change it to use -c99? My understanding is that normally you do this by editing the mexopts.sh file. However in this case, the mexopts.sh file appears to be auto-generated in the directory codegen/mex/<entry-point-file-name>, and is marked as read only, presumably indicating that it is not supposed to be altered. I tried to add "-c99" to the "Additional flags" under "More settings" under the Build tab, but that didn't seem to do anything. What is the correct way to get it to use -c99 instead of -ansi? Am I supposed to use "chmod +w" on mexopts.sh so that I can edit it?

Risposte (1)

John Elliott
John Elliott il 17 Feb 2015
Hi Alexander,
I think that there are a number of solutions. First, you can do as you suggest, and modify the generated mexopts.sh file. Alternatively, and perhaps preferably, you could pre-compile the C files that use C99, and use the generated object files or library file with the codegen command, rather than the C99 C source files. This latter solution assumes that the C99 C files don't depend on the C or H files generated by the codegen command.
-John

Categorie

Scopri di più su Build Configuration in Help Center e File Exchange

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by