Reputation: 175
I have a Matlab program that uses and compiles C code. Now the C code uses a
defines.h
file containing all the defines for my source code. Now there is one define that is making trouble in Matlab and I would like to "deactivate" it whenever Matlab is compiling the .c files. I do not want to remove the define since I need it, when I compile my source code with gcc (without Matlab). Is there any way to "redefine" a value within the compilation process in Matlab?
Here is a code snippet of my compilation process from Matlab:
mex CFLAGS='$CFLAGS -Wall -Wextra -pedantic -std=c99 -DMATLAB_MEX' function.c
Thanks!
Upvotes: 0
Views: 196
Reputation: 4100
Just make sure you have something like the following in defines.h
#ifndef MATLAB_MEX
// code to "deactivate" when compling mex functions
#endif
Upvotes: 1