MATLAB Answers

Mex, how to make visual studio support C11 standard?

45 views (last 30 days)
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?

Accepted Answer

Bruno Luong
Bruno Luong on 26 Dec 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 Comment
Xingwang Yong
Xingwang Yong on 26 Dec 2020
Sorry, I just qucikly looked through web page and did not realize C11 is not supported.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!