我正在尝试从 C++ 源代码编译一些 MATLAB MEX 文件。我要编译的文件可以在这里找到;我在 32 位系统 MATLAB 2012a 上使用 Windows XP,并安装了 Microsoft Windows SDK v7.1 作为我的编译器。
如果我尝试编译,MATLAB 会输出以下错误:
>> mex -O -largeArrayDims osc_free_address.c
osc_free_address.c
osc_free_address.c(1) : error C2059: syntax error : '<'
osc_free_address.c(37) : error C2015: too many characters in constant
osc_free_address.c(38) : error C2059: syntax error : '<'
osc_free_address.c(39) : error C2015: too many characters in constant
osc_free_address.c(39) : error C2015: too many characters in constant
osc_free_address.c(39) : error C2015: too many characters in constant
osc_free_address.c(41) : error C2018: unknown character '0x40'
osc_free_address.c(43) : error C2015: too many characters in constant
osc_free_address.c(44) : error C2015: too many characters in constant
osc_free_address.c(44) : error C2015: too many characters in constant
osc_free_address.c(44) : error C2015: too many characters in constant
osc_free_address.c(44) : error C2015: too many characters in constant
osc_free_address.c(46) : error C2059: syntax error : '<'
osc_free_address.c(82) : fatal error C1021: invalid preprocessor command 'page'
C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: Compile of 'osc_free_address.c' failed.
Error using mex (line 206)
Unable to complete successfully.
我使用mex -setup来设置我的编译器和Microsoft Windows SDK v7.1。有趣的是,虽然我在我的系统上安装了它们,但 MATLAB 看不到 MS Visual Studio C++ 2008或2010。我还尝试使用Lcc-win32 C 2.4.1编译器(MATLAB识别)进行编译,结果相同效果如上图。
我知道这组特定的 C++ 源文件可能需要一些名为liblo的东西来编译(我不确定这是编译时还是运行时的要求);据我所知,我已经正确安装了这些,但问题也可能出在此处。
任何帮助将不胜感激。