mex should treat C files as C++
Søren Hauberg
soren at hauberg.org
Thu Jan 8 02:44:33 CST 2009
Hi All,
Once in a while I have to use mex files that people distribute. Or
rather, I have to compile the source code they distribute using the
'mex' command. A couple of times I have been struck be a small issue:
Some people seem to use non-C keywords (e.g. 'true' and 'false') in
their code, but they save the source code in a file that ends with
'.c' (like 'my_function.c'). When I run the 'mex' command I get errors
like these:
kernel_function.c: In function ‘mexFunction’:
kernel_function.c:37: fejl: ‘true’ undeclared (first use in this
function)
kernel_function.c:37: fejl: (Each undeclared identifier is reported
only once
kernel_function.c:37: fejl: for each function it appears in.)
kernel_function.c:44: fejl: ‘false’ undeclared (first use in this
function)
The problem goes away if I rename the files to something that ends with
'.cc'. I guess this means 'mkoctfile' (which is called by 'mex') uses
'gcc' and not 'g++'. Could we change this, such that 'g++' is called
instead of 'gcc'?
Søren
More information about the Bug-octave
mailing list