Solved

mcc.h and mex.h problems

Posted on 1997-07-10
7
1,133 Views
Last Modified: 2012-08-14
Hi,

i was trying to compile an .m file into C code using Matlab mcc. It worked fine but when i compile the C code into executable i first got the errors ;

testmcc.c: 10: Can't find include file mex.h
testmcc.c: 11: Can't find include file mcc.h
(although my paths were set up correctly)

I then edited the C code to directly look for these two header files explictly using ;

#include "/produit/matlab/extern/include/mex.h"
#include "/produit/matlab/extern/include/mcc.h"

This then didn't throw up the previous errors but instead a few dozen originating from the mcc.h file, for example ;

"/produit/matlab/extern/include/mcc.h", line 173: syntax error at or near type word "char"

__________

I am using a UNIX system with Matlab 4.2c and cc. Can anyone help?
Many thanks,
Lan.
0
Comment
Question by:lanhlam
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 5

Expert Comment

by:julio011597
ID: 1252071
AFAIK, you are not allowed to include full paths for your header files.
So, get rid of the paths, and try again to check your compiling and linking options.
0
 

Author Comment

by:lanhlam
ID: 1252072
Hi Julio,

i've tried successfully b4 to add paths in header files. It also
seems to work here too. The problem of allocating mcc.h and mex.h
is cured and i'd like some help on the next part. Anyway, thanx!
0
 
LVL 1

Expert Comment

by:TKII
ID: 1252073
Try this:

Check your include path settings and change your includes to

#include <mex.h>
#include <mcc.h>


0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:lanhlam
ID: 1252074
Hi TKII,

i think that should solve the first two errors - of not being
able to find mex.h & mcc.h BUT not the last one. To be honest
the first two errors are easy to sort out. Since i already now
how to do that i'll have to give you a FAIL. Sorry!
0
 
LVL 1

Expert Comment

by:TKII
ID: 1252075
Ok, no problem but send some lines of this file (lines near to line 173) and send some lines from the files where you are including this. Does the char type give this error if you are using it, too?
0
 

Accepted Solution

by:
applePie earned 70 total points
ID: 1252076
Lan,

The #include directives should work using

   #include "mex.h"
   #include "mcc.h"

unless your MATLAB environment variable is not set.
If it is not set, set it like this:

   set MATLAB=/produit/matlab

Let me know if this works.  I had similar problems when
I started using cmex.

Bye,
David

0
 

Expert Comment

by:applePie
ID: 1252077
Lan,

Bye the way, you will have to copy the default .mexrc.sh file
to your home directory and go to the part at the end and change
it to look like this

#############################################################################
#
# Architecture independent lines:
#
#     Set and uncomment any lines which will apply to all architectures.
#
#----------------------------------------------------------------------------
# cmex & fmex
            MATLAB=/produit/matlab
#           CC=
#           CFLAGS=
#           LD=
#           LDFLAGS=
#           FC=
#           FFLAGS=
#           LD_FCLIBS=
# cmex only
#           LD_CCLIBS=
#----------------------------------------------------------------------------
#############################################################################

This will set your MATLAB environment variable whenever you
call the cmex program.When the .mexrc.sh file is called, is starts a new shell and all the environment variables have to
be set by the .mexrc.sh file itself.  When you call cmex, it
looks to see if you have a copy of .mexrc.sh in your home
directory and uses it.  Otherwise, it uses the one in

   /produit/matlab/bin

This one won't have the MATLAB variable set right, unless
your sysadmin is better than ours and did it for you.

Bye,
David


0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now