How to enable compiler options for ISO C++ 2011 standard in MATLAB R2016a
15 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Ashley Stephenson
il 15 Giu 2016
Risposto: Paul Rötzer
il 15 Lug 2022
I am receiving the below error when trying to compile a cpp file using mex. Mex is configured to use 'MinGW64 Compiler (C++)' for C++ language compilation, but I am wondering how to go about enabling the compiler options stated in the error message. Steps for how to do this would be appreciated.
error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
0 Commenti
Risposta accettata
Titus Edelhofer
il 16 Giu 2016
Hi Ashley,
try to add the flag to the compiler options like this:
mex -v COMPFLAGS='$COMPFLAGS -std=c++11' yourmexfile.c
Titus
4 Commenti
JEROME GARCIA
il 15 Feb 2018
mex COMPFLAGS=''$COMPFLAGS /std:c++latest'' yourmexfile.cpp
and it worked fine,
regards, Jérôme
michael bronnmann
il 8 Giu 2020
This works fine using mex-command. But how to set this compile flag for rtw-build?
Più risposte (1)
Paul Rötzer
il 15 Lug 2022
It didn't work for me on MacOS. Following Mex Documentation i could see that for MacOS, MinGW and Linux compilers the following hast to be done:
mex -v CXXFLAGS='$CXXFLAGS -std=c++11' yourmexfile.c
0 Commenti
Vedere anche
Categorie
Scopri di più su MATLAB Support for MinGW-w64 C/C++ Compiler in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!