Editing mex compiler through mex setup in matlab

조회 수: 3 (최근 30일)
Sarah
Sarah 2012년 5월 10일
댓글: Abul Fujail 2013년 10월 25일
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.

답변 (1개)

Kaustubha Govind
Kaustubha Govind 2012년 5월 10일
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
Abul Fujail
Abul Fujail 2013년 10월 25일
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...

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by