Wired MEX compiler error

1 回表示 (過去 30 日間)
Denis Bethäuser
Denis Bethäuser 2017 年 1 月 11 日
コメント済み: James Tursa 2019 年 12 月 2 日
Hey there, I tried to compile the example program for the HCRF library of Yale Song. The source can be found here: HCRFlight. I use Ubuntu 16.04, Matlab R2016b and the g++ 4.7 as commented by Mathworks. During the compilation of the library I get this strange compiler error:
Error using mex /usr/share/MATLAB/R2016b/extern/version/cpp_mexapi_version.cpp: In Funktion »void mexfilerequiredapiversion(unsigned int*, unsigned int*)«: /usr/share/MATLAB/R2016b/extern/version/cpp_mexapi_version.cpp:6:21: Fehler: »MX_TARGET_API_VER« wurde in diesem Gültigkeitsbereich nicht definiert
Which basically means that "MX_TARGET_API_VER" is not defined in this scope. As you can see from the path, the error occurs in a file from Mathworks. How may I solve this error? I’m kinda confused by the error message and I haven’t found anything on google.
  1 件のコメント
Vandana Ravichandran
Vandana Ravichandran 2017 年 1 月 19 日
I am receiving the same error in MATLAB R2016b. However, the code compiled successfully in MATLAB R2016a. Can you try this in R2016a?

サインインしてコメントする。

回答 (1 件)

Vandana Ravichandran
Vandana Ravichandran 2017 年 1 月 19 日
The mex compilation is successful in MATLAB R2016a. However, in MATLAB R2016b we receive an error - "MX_TARGET_API_VER was not declared in this scope"
The problem is because of the "matrix.h" file present in the library in the folder hCRFlight/lib/matlab/include/
This is a custom version of "matrix.h" which looks like a revision of "matrix.h" shipped with MATLAB R2016a.
In MATLAB R2016b, some MEX related changes were made to "matrix.h". The MEX command fails in R2016b because the revised R2016a version of "matrix.h" is not compatible with the official R2016b version of "matrix.h".
In order to make the package work with MATLAB R2016b:
a. You may revise the custom "matrix.h" to include all the contents from the R2016b version of "matrix.h".
b. Refactor the code to always include the default "matrix.h" shipped with MATLAB R2016b and use a different header file to contain other definitions from the custom "matrix.h".
  3 件のコメント
Ashley Ware
Ashley Ware 2019 年 12 月 1 日
I am also having this issue. Were you able to find a solution?
James Tursa
James Tursa 2019 年 12 月 2 日

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMATLAB Compiler についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by