Editing mex compiler through mex setup in matlab

I am running a C++ mex file in Matlab on a new server, which does not have g++ installed, just g++-4.6. My mexopts.sh file is set to CXX='g++', and as I do not have root access on the server, am unable to do the simple fix and sudo edit that.
I have been trying to figure out how to use mex -setup, or any type of command through Matlab to set the C++ compiler, with no luck.
The best luck I had was when I tried mex CXX="g++-4.6" hello_world.cpp, and it compiled. But then I got the error "version `GLIBCXX_3.4.11' not found", which I believe is a linking artifact from my hack method of forcing it to compile.
Question: how do you edit the compiler in Matlab when you do not have root access? This is a Linux server.

Antworten (1)

Kaustubha Govind
Kaustubha Govind am 10 Mai 2012

1 Stimme

When you use "mex -setup", a MEX-options file is generated into your home folder on *nix and in the Application Data folder on Windows - so you shouldn't need to have root/admin access to create/modify this file. What happens when you run mex -setup?
Note that you can always override the default mexopts.sh by using the mex -f option. For example:
>> mex -f /home/username/mymexopts.sh mymexfile.c

1 Kommentar

Abul Fujail
Abul Fujail am 25 Okt. 2013
after setup, i try to edit and compile the existing mex file but it was showing the error "C:\PROGRA~1\MATLAB\R2009B\BIN\MEX.PL: Error: 'anfischeck.c' not found."... i have copied this file in different folders and tested... plz suggest me...

Melden Sie sich an, um zu kommentieren.

Kategorien

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

Gefragt:

am 10 Mai 2012

Kommentiert:

am 25 Okt. 2013

Community Treasure Hunt

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

Start Hunting!

Translated by