libsvm.cpp 编译错误 MATLAB
Posted
技术标签:
【中文标题】libsvm.cpp 编译错误 MATLAB【英文标题】:libsvm.cpp compile error MATLAB 【发布时间】:2011-07-02 11:46:15 【问题描述】:我已经从official site 下载了libsvm for MATLAB (我正在使用 MATLAB 2010b) 但是每当我运行 make 文件时,我都会得到:
>> make
Error svm.cpp: 13 syntax error; found `<' expecting `;'
Error svm.cpp: 13 skipping `<'
Error svm.cpp: 13 syntax error; found `T' expecting `;'
Error svm.cpp: 13 syntax error; found `>' expecting `;'
Error svm.cpp: 13 skipping `>'
Error svm.cpp: 13 syntax error; found `T' expecting `;'
Error svm.cpp: 13 syntax error; found `min' expecting `;'
Error svm.cpp: 13 syntax error; found `x' expecting `)'
Error svm.cpp: 13 skipping `x' `,' `T' `y'
Error svm.cpp: 13 undeclared identifier `x'
Error svm.cpp: 13 undeclared identifier `y'
Warning svm.cpp: 13 possible usage of x before definition
Warning svm.cpp: 13 possible usage of y before definition
Error svm.cpp: 16 syntax error; found `<' expecting `;'
Error svm.cpp: 16 skipping `<'
Error svm.cpp: 16 syntax error; found `T' expecting `;'
Error svm.cpp: 16 syntax error; found `>' expecting `;'
Error svm.cpp: 16 skipping `>'
Error svm.cpp: 16 syntax error; found `T' expecting `;'
Error svm.cpp: 16 syntax error; found `max' expecting `;'
Error svm.cpp: 16 syntax error; found `x' expecting `)'
Error svm.cpp: 16 skipping `x' `,' `T' `y'
Error svm.cpp: 16 too many errors
C:\MATLAB\R2010B\BIN\MEX.PL: Error: Compile of 'svm.cpp' failed.
??? Error using ==> mex at 208
Unable to complete successfully.
Error in ==> make at 5
mex -O -c svm.cpp
甚至执行单个指令,例如: mex -O -c svm.cpp
我遇到同样的错误,我做错了什么
警察局
我已验证编译器问题:
>> mex -setup
Please choose your compiler for building external interface (MEX) files:
Would you like mex to locate installed compilers [y]/n? y
Select a compiler:
[1] Lcc-win32 C 2.4.1 in C:\MATLAB\R2010b\sys\lcc
[0] None
Compiler: 1
Please verify your choices:
Compiler: Lcc-win32 C 2.4.1
Location: C:\MATLAB\R2010b\sys\lcc
Are these correct [y]/n? y
Trying to update options file: C:\AppData\Roaming\MathWorks\MATLAB\R2010b\mexopts.bat
From template: C:\MATLAB\R2010b\bin\win32\mexopts\lccopts.bat
Done . . .
**************************************************************************
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the new
API. You can find more information about this at:
http://www.mathworks.com/support/solutions/en/data/1-5C27B9/?solution=1-5C27B9
Building with the -largeArrayDims option enables the new API.
**************************************************************************
【问题讨论】:
你没有提到平台,但是你有没有安装微软的Visual-Studio编译器? 不,我没有安装微软的 Visual-Studio 编译器 【参考方案1】:Matlab自带的编译器是lcc:http://www.cs.virginia.edu/~lcc-win32/,是C编译器,所以不能编译cpp代码。见这里:http://www.mathworks.com/support/tech-notes/1600/1605.html#C_compiling
您必须通过mex -setup
或自己编辑mexopts.bat
安装另一个编译器并配置Matlab 才能使用它。
【讨论】:
以上是关于libsvm.cpp 编译错误 MATLAB的主要内容,如果未能解决你的问题,请参考以下文章
如何从 MATLAB applicationCompiler 命令中捕获错误