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

时间:2015-04-13 08:30:43

标签: c++ matlab mex

编译mex文件时得到上面提到的错误。我使用MATLAB2013和mex编译器:Microsoft SDK 7.1。我希望编译器打印的以下debuging信息可能有用:

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

1 个答案:

答案 0 :(得分:2)

这里是-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。