Downgrading gcc/g++ for use with mex

3 vues (au cours des 30 derniers jours)
KV
KV le 16 Juil 2017
Modifié(e) : Amit Doshi le 18 Juil 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,

Réponses (1)

Amit Doshi
Amit Doshi le 18 Juil 2017
Modifié(e) : Amit Doshi le 18 Juil 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:

Catégories

En savoir plus sur Write C Functions Callable from MATLAB (MEX Files) dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by