Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

mcc.h and mex.h problems

Posted on 1997-07-10
7
Medium Priority
?
1,169 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 140 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
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.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
Suggested Courses

886 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