Solved

mcc.h and mex.h problems

Posted on 1997-07-10
7
1,151 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

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…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

623 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