Downgrading gcc/g++ for use with mex

3 Ansichten (letzte 30 Tage)
KV
KV am 16 Jul. 2017
Bearbeitet: Amit Doshi am 18 Jul. 2017
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,

Antworten (1)

Amit Doshi
Amit Doshi am 18 Jul. 2017
Bearbeitet: Amit Doshi am 18 Jul. 2017
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:

Kategorien

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

Community Treasure Hunt

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

Start Hunting!

Translated by