user3884651
user3884651

Reputation: 11

mex compile error: Unrecognized switch: -cxx

when compiling a mex file a get the error mentioned above. I use MATLAB2013 with the mex-compiler: Microsoft SDK 7.1 . I hope the following debuging information which was printed by the compiler may be useful:

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

Upvotes: 0

Views: 1987

Answers (1)

SCFrench
SCFrench

Reputation: 8374

Here's the help for the -cxx MEX command line option:

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.

As you can see, it says that -cxx is available only on UNIX platforms. I don't think you need to do anything special to compile C++ MEX on Windows; just call mex the way you were, but without -cxx.

Upvotes: 2

Related Questions