mex 编译错误: 无法识别的开关: -cxx

mex compile error: Unrecognized switch: -cxx

本文关键字:开关 -cxx 识别 编译 错误 mex      更新时间:2023-10-16

编译 mex 文件 a 时会出现上述错误。我将MATLAB2013与 mex 编译器一起使用:Microsoft SDK 7.1 。我希望编译器打印的以下调试信息可能有用:

vl_compilenn: * Compiler and linker configurations *
vl_compilenn:   intermediate build products directory: 
C:Dima  Projects_C   Librariesmatconvnetmatlabmex.build
vl_compilenn:   MEX files: C:DimaProjects_CLibrariesmatconvnetmatlab
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:DimaProjects_CLibrariesmatconvnetmatlab
mex.build matlabsrcvl_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~1MATLABR2013ABINMEX.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。