Mex, how to make visual studio support C11 standard?

6 Ansichten (letzte 30 Tage)
Xingwang Yong
Xingwang Yong am 26 Dez. 2020
Kommentiert: Xingwang Yong am 26 Dez. 2020
I am building a mex function from c language, which uses a non-standard data type, i.e. double complex,
double complex *my_function ( int n, double complex a[] );
When I build on linux using gcc 7.2.0, there is no problem.
When I build on windows using MinGw, there is no problem.
When I build on windows using visual studio 2017, it throws syntax error, "error C2143: syntax error: missing '{' before '*'". I believe this error indicates visual studio does not support the data type double complex. I learned from here visual studio 2019 supports C11 and C17. Since C99 standard already support double complex, C11 and C17 will support, too. So I switched to visual studio 2019, and run the following command,
opts{1} = '-g'; % for debug
opts{2} = 'COMPFLAGS="$COMPFLAGS /std:c11"'; % add support for C11 standard
mex('-v',opts{:}, 'my_file.c');
However, the syntax error comes again.
So, how can I make visual studio support C11 standard?

Akzeptierte Antwort

Bruno Luong
Bruno Luong am 26 Dez. 2020
"What’s not:
While there is currently no support for any C11 optional features, we are committed to providing the most impactful optional features in future releases. Atomic and threading support are on our roadmap. Support for Complex numbers is currently not planned and their absence is enforced with the proper feature test macros. Please go to Visual Studio Developer Community and voice your support for features you wish to be implemented. We are looking for your input that we are making the correct prioritizations."
  1 Kommentar
Xingwang Yong
Xingwang Yong am 26 Dez. 2020
Sorry, I just qucikly looked through web page and did not realize C11 is not supported.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

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