Filter löschen
Filter löschen

Specifying a different mexsh

2 Ansichten (letzte 30 Tage)
Nicolas am 3 Okt. 2013
Kommentiert: Royi Avital am 20 Okt. 2013
I'm new to mex-files. I'm trying to compile a file written in C in folder A, with a header in some folder B, using a custom file that was handed to me. How can I specify that I want to use when I run the mex command?
>>mex myFile.c
Also, trying on an sample mex-file
>>mex timestwo.c
produces the following error:
xcodebuild: error: SDK "macosx10.7" cannot be located.
xcrun: error: unable to find utility "clang", not a developer tool or in PATH
mex: compile of ' "timestwo.c"' failed.
I am using OS X 10.8.5, MATLAB 2013b ( and Xcode 5.0 with
If anyone could shed some light on this, I'd really appreciate it.
  1 Kommentar
Royi Avital
Royi Avital am 20 Okt. 2013
Is build the is the release version of MATLAB 8.2 (R2013b)?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Harsheel am 3 Okt. 2013
You can provide your custom options file via the -f flag:
>>mex myFile.c -f
% assuming the options file is in the same folder as myFile.c else provide the full path to
% the options file.
Source: MexOptions
As a side note, since you're using Xcode 5.0, replace all instances of "10.7" in the option file with "10.8". However if your custom options file works just fine, then you can ignore this statement.
  2 Kommentare
Nicolas am 3 Okt. 2013
Thanks for the quick reply Harsheel, really appreciate it. One more thing, a header I'm including is in a different folder, what switch should be used?
I tried
mex myfile.c -f -LheaderPath/header.h
to no avail: it produces an error saying file 'header.h' was not found.
Thanks a bunch,
Harsheel am 3 Okt. 2013
you're welcome Nicolas. Please refer to the following link for your question:

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Ken Atwell
Ken Atwell am 4 Okt. 2013
Xcode 5 removed the 10.7 SDK that MEX is looking for. See:
  1 Kommentar
Nicolas am 4 Okt. 2013
Thanks Ken! This is one of the reasons I wanted to use a custom mexopts shell script.

Melden Sie sich an, um zu kommentieren.


Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Help Center und File Exchange


Community Treasure Hunt

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

Start Hunting!

Translated by