编译mex文件时,出现上述错误。我将MATLAB2013与mex编译器一起使用:Microsoft SDK 7.1。我希望编译器打印的以下调试信息可能有用:
vl_compilenn: * Compiler and linker configurations *
vl_compilenn: intermediate build products directory:
C:\Dima \Projects_C \Libraries\matconvnet\matlab\mex\.build
vl_compilenn: MEX files: C:\Dima\Projects_C\Libraries\matconvnet\matlab
\mex/
vl_compilenn: MEX compiler options: -DNDEBUG -D__SSSE3__ -cxx
vl_compilenn: MEX linker options: -lmwblas -lgdiplus
vl_compilenn: * Reading images *
vl_compilenn: vl_imreadjpeg enabled
vl_compilenn: image library: gdiplus
vl_compilenn: image library compile flags:
vl_compilenn: image library link flags: -lgdiplus
vl_compilenn: MEX: -outdir C:\Dima\Projects_C\Libraries\matconvnet\matlab
\mex\.build matlab\src\vl_imreadjpeg.cpp -c -DNDEBUG -D__SSSE3__ -cxx
Usage:
MEX [option1 ... optionN] sourcefile1 [... sourcefileN]
[objectfile1 ... objectfileN] [libraryfile1 ... libraryfileN]
Use the -help option for more information, or consult the MATLAB API Guide.
C:\PROGRA~1\MATLAB\R2013A\BIN\MEX.PL: Error: Unrecognized switch: -cxx
最佳答案
这是-cxx MEX命令行选项的帮助:
Command Line Options Available Only on UNIX Platforms:
-cxx
Use the C++ linker to link the mex-file if the first source file
is in C and there are one or more C++ source or object files. This
option overrides the assumption that the first source file in
the list determines which linker to use.
如您所见,它说-cxx仅在UNIX平台上可用。我认为您不需要做任何特殊的事情就可以在Windows上编译C ++ MEX。只需按原样调用mex,但不使用-cxx。
关于c++ - mex编译错误:无法识别的开关:-cxx,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29600987/