Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 其它 > 资料存档
资料存档 资料存档
回复
 
主题工具 显示模式
旧 2019-12-14, 20:13   #1
poster
高级会员
 
注册日期: 2019-11-21
帖子: 3,006
声望力: 66
poster 正向着好的方向发展
帖子 libsvm.cpp编译错误MATLAB

我已经从官方站点下载了libsvm for MATLAB (我正在使用MATLAB 2010b),但是每当运行make文件时,我都会得到:

>> make Error svm.cpp: 13 syntax error; found `' 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 `' 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/sol...ution=1-5C27B9 Building with the -largeArrayDims option enables the new API. **************************************************************************

回答:

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以使用它。



更多&回答...
poster 当前离线   回复时引用此帖
回复


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛禁用 表情符号
论坛启用 [IMG] 代码
论坛启用 HTML 代码



所有时间均为北京时间。现在的时间是 03:16


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.