How to create c-file???
How to create c-file???
(OP)
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
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





RE: How to create c-file???
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
RE: How to create c-file???
I hope this thread is talking about Solution Number: 25176 (http://www.mathworks.com/support/solutions/data/25176.shtml).
When trying "mbuild mymain.c test.c", I got following error:
======================================
cc: acomp failed for mymain.c
mbuild: compile of 'mymain.c' failed.
========================================
in addition to a long list of warnings
========================================
"/opt/matlabr13/extern/include/libmwsglm.h", line 1091: warning: parameter has incomplete type: prhs
"/opt/matlabr13/extern/include/libmwsglm.h", line 1094: warning: parameter has incomplete type: plhs
"/opt/matlabr13/extern/include/libmwsglm.h", line 1096: warning: parameter has incomplete type: prhs
"/opt/matlabr13/extern/include/libmwsglm.h", 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 http://www.mathworks.com/support/tech-notes/1600/1621.shtml).
Thanks in advance for your help.