首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >libsvm.cpp编译错误MATLAB

libsvm.cpp编译错误MATLAB
EN

Stack Overflow用户
提问于 2011-02-23 11:51:41
回答 1查看 3.7K关注 0票数 4

我已经从official site下载了libsvm for MATLAB (我使用的是MATLAB 2010b),但每当我运行make文件时,我都会得到:

代码语言:javascript
复制
 >> 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

我得到同样的错误,我做错了什么?

警察。

我已经验证了编译器问题:

代码语言:javascript
复制
>> 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. 
************************************************************************** 
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-02-23 21:11:08

Matlab附带的内置编译器是lcc:http://www.cs.virginia.edu/~lcc-win32/,这是一个C编译器,因此它不能编译cpp代码。查看此处:http://www.mathworks.com/support/tech-notes/1600/1605.html#C_compiling

您必须安装另一个编译器并配置Matlab才能使用它,可以通过mex -setup,也可以通过自己编辑mexopts.bat

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5086817

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档