×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

How to create c-file???

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

RE: How to create c-file???

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  

RE: How to create c-file???

Hi,

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources