ubuntu 1204 mex使用不能的解决办法
2014-05-03 13:24
267 查看
1. 安装gcc g++
参考:http://stefaanlippens.net/cpp_mex_ubuntu804zhang@ubuntu-desktop:~$ sudo apt-get install gcc-4.3 g++-4.3
2. At the MATLAB Command Window prompt, type:
>> mex -setupOptions files control which compiler to use, the compiler and link command options, and the runtime libraries to link against. Using the 'mex -setup' command selects an options file that is placed in /home/zhang/.matlab/R2011b and used by default for 'mex'. An options file in the current working directory or specified on the command line overrides the default options file in /home/zhang/.matlab/R2011b. To override the default options file, use the 'mex -f' command (see 'mex -help' for more information). The options files available for mex are: 1: /usr/local/MATLAB/R2011b/bin/mexopts.sh : Template Options file for building gcc MEX-files 0: Exit with no changes Enter the number of the compiler (0-1): Overwrite /home/zhang/.matlab/R2011b/mexopts.sh ([y]/n)? y /usr/local/MATLAB/R2011b/bin/mexopts.sh is being copied to /home/zhang/.matlab/R2011b/mexopts.sh ************************************************************************** Warning: The MATLAB C and Fortran API has changed to support MATLAB variables with more than 2^32-1 elements. In the near future you will be required to update your code to utilize the new API. You can find more information about this at: http://www.mathworks.com/support/solutions/en/data/1-5C27B9/?solution=1-5C27B9 Building with the -largeArrayDims option enables the new API. **************************************************************************
3. 警告
>> mex test.cWarning: You are using gcc version "4.4.4-14ubuntu5)". The version currently supported with MEX is "4.3.4". For a list of currently supported compilers see: http://www.mathworks.com/support/compilers/current_release/[/code]
如果出现上述警告和错误,说明当前的Matlab版本不支持gcc 4.4。解决办法如下。zhang@ubuntu-desktop:~$ sudo gedit /usr/local/MATLAB/R2011b/bin/mexopts.sh
4. 编辑文件mexopts.sh #---------------------------------------------------------------------------- ;; glnxa64) #---------------------------------------------------------------------------- RPATH="-Wl,-rpath-link,$TMW_ROOT/bin/$Arch" # StorageVersion: 1.0 # CkeyName: GNU C # CkeyManufacturer: GNU # CkeyLanguage: C # CkeyVersion: CC='gcc-4.3' CFLAGS='-ansi -D_GNU_SOURCE' CFLAGS="$CFLAGS -fexceptions" CFLAGS="$CFLAGS -fPIC -fno-omit-frame-pointer -pthread" CLIBS="$RPATH $MLIBS -lm" COPTIMFLAGS='-O -DNDEBUG' CDEBUGFLAGS='-g' CLIBS="$CLIBS -lstdc++" # # C++keyName: GNU C++ # C++keyManufacturer: GNU # C++keyLanguage: C++ # C++keyVersion: CXX='g++-4.3' CXXFLAGS='-ansi -D_GNU_SOURCE' CXXFLAGS="$CXXFLAGS -fPIC -fno-omit-frame-pointer -pthread" CXXLIBS="$RPATH $MLIBS -lm" CXXOPTIMFLAGS='-O -DNDEBUG' CXXDEBUGFLAGS='-g' # # FortrankeyName: gfortran # FortrankeyManufacturer: GNU # FortrankeyLanguage: Fortran # FortrankeyVersion: # FC='gfortran-4.3' FFLAGS='-fexceptions -fbackslash' FFLAGS="$FFLAGS -fPIC -fno-omit-frame-pointer" FLIBS="$RPATH $MLIBS -lm" FOPTIMFLAGS='-O' FDEBUGFLAGS='-g' # LD="$COMPILER" LDEXTENSION='.mexa64' LDFLAGS="-pthread -shared -Wl,--version-script,$TMW_ROOT/extern/lib/$Arch/$MAPFILE -Wl,--no-undefined" LDOPTIMFLAGS='-O' LDDEBUGFLAGS='-g' # POSTLINK_CMDS=':' #----------------------------------------------------------------------------
绿色为原始部分;-4.3为增加部分。
参考:
https://help.ubuntu.com/community/MATLAB
http://ubuntuforums.org/showthread.php?p=7737533
重启matlab
相关文章推荐
- Ubuntu中Vitualbox不能使用USB的解决办法
- Ubuntu中不能使用ssh远程登录的解决办法;ssh服务的安装与配置
- Ubuntu中Vitualbox不能使用USB的解决办法
- Ubuntu14.04 USB接口有电,但是 所有的USB设备不能使用解决办法
- Ubuntu 14.04使用Qt5不能输入中文的解决办法
- ubuntu amd 64bit 安装 QQ for linux教程(附 不能使用中文的解决办法)
- ubuntu下emacs不能使用输入法的解决办法
- Ubuntu 14.04 触摸板不能使用的解决办法
- Ubuntu14.04下编译工具再root下不能使用解决办法
- ubuntu升级内核后 virtualbox不能使用解决办法
- Ubuntu中Vi方向键和退格键不能正确使用解决办法—附图
- ubuntu下新建用户的终端不显示当前路径,不能用上下光标键得到使用过的命名解决办法
- VMware 中安装ubuntu10.04后图形界面不能使用键盘登陆的解决办法
- 【ZYNQ LINUX】使用问题04 ubuntu12 环境变量修改错误,不能进入root 修改的解决办法
- 如何使用SecureCRT连接vmware下ubuntu 和vmware下ubuntu不能联网的解决办法
- ubuntu安装好matlab后键盘复制粘贴快捷键不能使用 解决办法
- ubuntu下virtualbox不能使用usb的解决办法
- ubuntu下安装搜狗输入法已经fcitx升级后搜狗输入法不能使用的解决办法
- Ubuntu1204下安装FreeSurfer使用Qdec时报libXss.so.1的问题的解决办法
- ubuntu 触摸板不能使用的解决办法