Matlab 2013b Mex function can't make gcc 4.7 work

1 view (last 30 days)
Problem: Mex function won't work - I'm using Ubuntu 13.04 and Matlab 2013b, and compatible gcc 4.7, so I don't need a different gcc version. Either gcc 4.7 is not installed correctly, or Matlab can't find it. Any solutions, please??!!
Error displays:
>> mex -setup
Options files control which compiler to use, the compiler and link command
options, and the runtime libraries to link against.
Using the 'mexsh -setup' command selects an options file that is
placed in /home/edward/.matlab/R2013b and used by default for 'mexsh'. An options
file in the current working directory or specified on the command line
overrides the default options file in /home/edward/.matlab/R2013b.
To override the default options file, use the 'mexsh -f' command
(see 'mexsh -help' for more information).
The options files available for mexsh are:
1: /usr/local/MATLAB/R2013b/bin/mexopts.sh :
Template Options file for building MEX-files
0: Exit with no changes
Enter the number of the compiler (0-1):
mex LOAD_WGhrly2.c
mex: LOAD_WGhrly2.c not a normal file or does not exist.
Unable to complete successfully.
  1 Comment
Kaustubha Govind
Kaustubha Govind on 25 Sep 2013
Does the file LOAD_WGhrly2.c exist in the current working directory? The error message seems to suggest otherwise. Perhaps you can try running:
>> !ls LOAD_WGhrly2.c

Sign in to comment.

Accepted Answer

Edward
Edward on 26 Sep 2013
Thanks, it appears that Matlab was trying to access a different folder, so I moved my files into that one rather than mess about with setting paths. Plus, I now know that you have to use the matlab terminal to 'cd' into the directory where the file is before you can mex it. Thanks.

More Answers (0)

Categories

Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!