How do you get MATLAB Coder to use -c99 rather than -ansi?
4 views (last 30 days)
Show older comments
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?
0 Comments
Answers (1)
John Elliott
on 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
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!