Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

How to create c-file???

Status
Not open for further replies.

Guest
I created from test.m c-file test.c. I compiled this file, and I got following error:
fatal error C1083: Cannot open include file: 'matlab.h': No such file or directory
Error executing cl.exe.

Which is the problem reason? Why does it not work?

Thanks,

betty
 
Replies continue below

Recommended for you

Betty

I'm not sure how you are compiling the code; are you using the command line compiler? You need to use the mbuild compiler script inside matlab. You set this scrip up with the command "mbuild -setup", and than use "mbuild test.c" to compile the code.
If using mbuild doesn't work, provide the information below.

What machine are you compiling on (Unix or PC).
What compiller do you have?
Do you have matlab.h in directory <matlab>/extern/include?
This can be checked with

dpath = fullfile(matlabroot,'extern','include')
dir(dpath)

Let me know.

John
 
Hi,

I hope this thread is talking about Solution Number: 25176 (
When trying &quot;mbuild mymain.c test.c&quot;, I got following error:
======================================
cc: acomp failed for mymain.c

mbuild: compile of 'mymain.c' failed.
========================================
in addition to a long list of warnings
========================================
&quot;/opt/matlabr13/extern/include/libmwsglm.h&quot;, line 1091: warning: parameter has incomplete type: prhs
&quot;/opt/matlabr13/extern/include/libmwsglm.h&quot;, line 1094: warning: parameter has incomplete type: plhs
&quot;/opt/matlabr13/extern/include/libmwsglm.h&quot;, line 1096: warning: parameter has incomplete type: prhs
&quot;/opt/matlabr13/extern/include/libmwsglm.h&quot;, line 1112: warning: parameter has incomplete type: plhs
============================================
since the warning is too long, I can't see if there is any error messages during the compiling.

I had no error on 'mcc -mc test.m' to generate all the .c .h files.

The setup of mcc, mbuild, mex seems ok, testing with the provided files from MatLab (yprime.c, hello.m, ex1.c) all worked as described (at
Thanks in advance for your help.
 
Status
Not open for further replies.
Back
Top