Ошибка компиляции libsvm.cpp MATLAB - PullRequest
4 голосов
/ 23 февраля 2011

Я скачал libsvm для 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

Я получаю ту же ошибку, что я делаю неправильно

PD

Я проверил проблемы с компилятором:

>> 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. 
************************************************************************** 

1 Ответ

5 голосов
/ 23 февраля 2011

Встроенный компилятор, который поставляется с 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 самостоятельно.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...