Problem with #includes in mex file (seems to find the files, but creates a lot of errors - see below)

1 回表示 (過去 30 日間)
Fox Mulder
Fox Mulder 2021 年 7 月 28 日
回答済み: Yongjian Feng 2021 年 7 月 28 日
When I have a mex-file that works fine (with standard mex-includes) and then I simply put a new #include on top (without otherwise changing the code), I get 100s of error-messages like the ones below. It doesn't seem to matter, which includes. For example, I needed a better random number generator, so I tried "#include <random>". The error messages below are just the first few...
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\\..\..\VC\INCLUDE\cmath(28): error: identifier "using" is undefined
using _CSTD acosf; using _CSTD asinf;
^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\\..\..\VC\INCLUDE\cmath(28): error: declaration is incompatible with "float __cdecl acosf(float)" (declared at line 185 of "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\\..\..\VC\INCLUDE\math.h")
using _CSTD acosf; using _CSTD asinf;
^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\\..\..\VC\INCLUDE\cmath(28): error: identifier "using" is undefined
using _CSTD acosf; using _CSTD asinf;
^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\\..\..\VC\INCLUDE\cmath(28): error: declaration is incompatible with "float __cdecl asinf(float)" (declared at line 186 of "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\\..\..\VC\INCLUDE\math.h")
using _CSTD acosf; using _CSTD asinf;
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\\..\..\VC\INCLUDE\cmath(29): error: identifier "using" is undefined
using _CSTD atanf; using _CSTD atan2f; using _CSTD ceilf;
^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\\..\..\VC\INCLUDE\cmath(29): error: declaration is incompatible with "float __cdecl atanf(float)" (declared at line 187 of "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\\..\..\VC\INCLUDE\math.h")
using _CSTD atanf; using _CSTD atan2f; using _CSTD ceilf;

回答 (1 件)

Yongjian Feng
Yongjian Feng 2021 年 7 月 28 日
Seems like you need to play with the mex include path:

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by