Downgrading gcc/g++ for use with mex

4 ビュー (過去 30 日間)
KV
KV 2017 年 7 月 16 日
編集済み: Amit Doshi 2017 年 7 月 18 日
I'm running Matlab 2017a on an Ubuntu 16.04.2 LTS (xenial). The default gcc/g++ versions are 5.4.0 and Matlab only supports version 4.9.x.
Are there good suggestions on how to "downgrade" the g++/gcc versions so that I can have mex working OK?
Thanks,

回答 (1 件)

Amit Doshi
Amit Doshi 2017 年 7 月 18 日
編集済み: Amit Doshi 2017 年 7 月 18 日
Hello Karthik,
To change the compiler in the mex command, set the varname variable. varname for the gcc compiler is GCC, in uppercase letters. For example, if the currently supported gcc compiler is version 4.7, and it is installed in the /usr/bin/gcc-4.7 folder on your system, to build timestwo.c, type:
copyfile(fullfile(matlabroot,'extern','examples','refbook','timestwo.c'),'.','f')
mex -v GCC='/usr/bin/gcc-4.7' timestwo.c
Setting the compiler using the mex command does not change the system default compiler.
Also, refer the below link to downgrade GCC in Ubuntu:

カテゴリ

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