Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: c program fails to compile with mex, while cpp program compiles fine
Replies: 3   Last Post: Feb 1, 2013 1:55 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Curious

Posts: 1,966
Registered: 12/6/04
Re: c program fails to compile with mex, while cpp program compiles fine
Posted: Feb 1, 2013 1:24 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"shome" wrote in message <keg4a0$r58$1@newscl01ah.mathworks.com>...
> Hi,
> I get the following error while compiling hello.c
>

> >> mex hello.c
> /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.
>
> Hello.c:
>
> #include <math.h>
> #include <matrix.h>
> #include <mex.h>
>
> void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
> {
> mexPrintf("Hello World!\n");
> }
>
> if i rename hello.c to hello.cpp it compiles properly.
>
> I guess matlab missing the c compiler.How do i fix the above problem.


I may be completely off base here, but my understanding is that MATLAB doesn't "come" with a c compiler. It uses the c compiler you have (already) installed on your computer (with the "mex -setup" command).



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.