The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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 ]

Posts: 2,359
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$>...
> 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]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.