Link to home
Start Free TrialLog in
Avatar of lanhlam
lanhlam

asked on

mcc.h and mex.h problems

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.
Avatar of julio011597
julio011597

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.
Avatar of lanhlam

ASKER

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!
Try this:

Check your include path settings and change your includes to

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


Avatar of lanhlam

ASKER

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!
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?
ASKER CERTIFIED SOLUTION
Avatar of applePie
applePie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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