Editing mex compiler through mex setup in matlab

7 ビュー (過去 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 Center および File ExchangeWrite 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