Mex, how to make visual studio support C11 standard?

조회 수: 7 (최근 30일)
Xingwang Yong
Xingwang Yong 2020년 12월 26일
댓글: Xingwang Yong 2020년 12월 26일
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?

채택된 답변

Bruno Luong
Bruno Luong 2020년 12월 26일
"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
Xingwang Yong
Xingwang Yong 2020년 12월 26일
Sorry, I just qucikly looked through web page and did not realize C11 is not supported.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by