f



mex compiling c++ code but not c code

i get the following error when i try to compile the following code:

//hello.c

#include <mex.h>

void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
  mexPrintf("Hello World!\n");
}
/
usr/local/MATLAB/R2012a/bin/mex: 1: eval: -c: not found

    mex: compile of ' "hello.c"' failed.

Error using mex (line 206)
Unable to complete successfully.

when i use the same code but name it as hello.cpp it compiles fine & prints hello world.


im using matlab 2012a,ubuntu 12.04,gcc-4.6,g++-4.6

my mex-opts.sh has 

CC='gcc'
            CFLAGS='-ansi -D_GNU_SOURCE'

CXX='g++'
            CXXFLAGS='-ansi -D_GNU_SOURCE'

FC='gfortran'
            FFLAGS='-fexceptions -fbackslash'
 

Kindly advice
0
shome (4)
2/9/2013 11:07:07 AM
comp.soft-sys.matlab 211264 articles. 26 followers. lunamoonmoon (257) is leader. Post Follow

0 Replies
1326 Views

Similar Articles

[PageSpeed] 50

Reply: