• C

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.
lanhlamAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

julio011597Commented:
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
lanhlamAuthor Commented:
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
TKIICommented:
Try this:

Check your include path settings and change your includes to

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


0
Prepare for an Exciting Career in Cybersecurity

Help prevent cyber-threats and provide solutions to safeguard our global digital economy. Earn your MS in Cybersecurity. WGU’s MSCSIA degree program curriculum features two internationally recognized certifications from the EC-Council at no additional time or cost.

lanhlamAuthor Commented:
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
TKIICommented:
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
applePieCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
applePieCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C

From novice to tech pro — start learning today.