在 MATLAB 上使用 G++ 构建时出现问题
Problems building with G++ on MATLAB
我对 MATLAB 有点陌生,但目前正在尝试使用 G++(版本 6.3(作为编译器构建 MEX 文件。我收到此错误
MEX completed successfully.
Building with 'g++'.
Error using mex
/disks/local/sceneflow2/./external/libtrws/trwsMex.cpp:14:13: error: conflicting declaration ‘typedef
int mwSize’
In file included from /usr/local/MATLAB/R2016a/extern/include/matrix.h:25:0,
from /usr/local/MATLAB/R2016a/extern/include/mex.h:51,
from /disks/local/sceneflow2/./external/libtrws/trwsMex.cpp:9:
/usr/local/MATLAB/R2016a/extern/include/tmwtypes.h:795:19: error: ‘mwSize’ has a previous
declaration as ‘typedef size_t mwSize’
/disks/local/sceneflow2/./external/libtrws/trwsMex.cpp:15:13: error: conflicting declaration ‘typedef
int mwIndex’
In file included from /usr/local/MATLAB/R2016a/extern/include/matrix.h:25:0,
from /usr/local/MATLAB/R2016a/extern/include/mex.h:51,
from /disks/local/sceneflow2/./external/libtrws/trwsMex.cpp:9:
/usr/local/MATLAB/R2016a/extern/include/tmwtypes.h:796:19: error: ‘mwIndex’ has a previous
declaration as ‘typedef size_t mwIndex’
Error in make_mex (line 20)
mex ./external/libtrws/trwsMex.cpp -largeArrayDims CXXFLAGS="$CXXFLAGS -std=c++0x -fpermissive"
-outdir build
我不明白。为什么/usr/local/MATLAB/R2016a/extern/include/tmwtypes.h
mwSize
的定义与/usr/local/MATLAB/R2016a/extern/include/mex.h
冲突?它们不是包含在 MATLAB 中的预定义库吗(这意味着它们应该可以正常工作?
顺便说一下,/disks/local/sceneflow2/./external/libtrws/trwsMex.cpp
有一条线,其中包括上述mex.h
。
错误消息必须阻止(对于两个不同的错误(,让我们只看第一个。我把它分成三行:
/disks/local/sceneflow2/./external/libtrws/trwsMex.cpp:14:13: error: conflicting declaration ‘typedef int mwSize’ In file included from /usr/local/MATLAB/R2016a/extern/include/matrix.h:25:0, from /usr/local/MATLAB/R2016a/extern/include/mex.h:51, from /disks/local/sceneflow2/./external/libtrws/trwsMex.cpp:9: /usr/local/MATLAB/R2016a/extern/include/tmwtypes.h:795:19: error: ‘mwSize’ has a previous declaration as ‘typedef size_t mwSize’
第一行说编译器在trwsMex.cpp
文件的第 14 行找到了 mwSize
的声明,其中显示 typedef int mwSize
。
最后一行说这个mwSize
已经在 MATLAB 附带的tmwtypes.h
标头中定义。
第二行说这个头文件包含在 matrix.h
中,它包含在 mex.h
中,包含在第 9 行的trwsMex.cpp
中。
因此,要修复此错误,请不要在 MEX 文件源代码中定义mwSize
和mwIndex
,这些由 MATLAB 的标头定义。
相关文章:
- 如何解决 Ninja c++ 构建和执行问题
- macOS 上的 openvino 构建问题
- 在树莓派上用libtorch构建程序时的链接问题
- 使用 MinGW 在 Windows 上构建 GLEW 时遇到问题
- 构建LLVM 10 C++工具链的问题
- 在Visual Studio 2017中使用c ++组件构建python解决方案时出现问题
- 调试模板时出现问题.专门针对 Linux GCC 7、GCC 6、GCC 5、GCC 4.9 错误构建失败:模板参数 1
- 构建OpenCV的基本CMakefile问题
- wxWidgets jpeg库构建问题
- exteranl原生构建问题,构建命令失败,android工作室
- 使用 Bazel (Windows) 构建 Tensorflow 的问题 => 使用 Tensorflow C++ API
- 使用 CMake 构建 {fmt} 时出现问题
- 使用 RcppArmadillo 构建 R 包的问题
- 使用 cmake 构建 dOxygen 的问题
- PCL 构建存在 boost::throw_exception 问题
- TFS构建由于链接问题而失败
- 构建Makefile的问题
- 修复了安装 OSRM 时使用"make"命令时的构建问题
- 在 MATLAB 上使用 G++ 构建时出现问题
- 在构建基于 C++ 的软件时包含 QtGui 文件的问题