嗨我试图编译一个C++文件即,用于连接Matlab到mysql数据库的mysql.cpp。 我之前使用过相同的文件,并且能够在没有任何问题的情况下进行编译,但昨天我不得不重新安装Matlab,当我尝试编译该文件时,虽然我没有对cpp文件进行任何更改,但出现很多语法错误。 作为参考,该文件是从这里取: -mysql.cpp在MATLAB编译错误
http://www.mathworks.com/matlabcentral/fileexchange/8663-mysql-database-connector
我收到以下错误: -
Error mysql.cpp: 57 illegal initialization for parameter 'n'
Error mysql.cpp: 98 syntax error; found 't' expecting ')'
Error mysql.cpp: 98 skipping 't'
Error mysql.cpp: 100 undeclared identifier 't'
Warning mysql.cpp: 100 possible usage of t before definition
Error mysql.cpp: 177 syntax error; found 'int' expecting ';'
Error mysql.cpp: 177 syntax error; found 'int' expecting ';'
Error mysql.cpp: 177 syntax error; found 'int' expecting ')'
Error mysql.cpp: 177 skipping 'int'
Error mysql.cpp: 177 undeclared identifier 'j'
Warning mysql.cpp: 177 Statement has no effect
Warning mysql.cpp: 177 unreachable code
Error mysql.cpp: 177 syntax error; found ')' expecting ';'
Error mysql.cpp: 177 illegal statement termination
Error mysql.cpp: 177 skipping ')'
Error mysql.cpp: 183 syntax error; found 'int' expecting ';'
Error mysql.cpp: 183 syntax error; found 'int' expecting ';'
Error mysql.cpp: 183 syntax error; found 'int' expecting ')'
Error mysql.cpp: 183 skipping 'int'
Error mysql.cpp: 183 undeclared identifier 'j'
Warning mysql.cpp: 183 Statement has no effect
Warning mysql.cpp: 183 unreachable code
Error mysql.cpp: 183 syntax error; found ')' expecting ';'
Error mysql.cpp: 183 illegal statement termination
Error mysql.cpp: 183 skipping ')'
Error mysql.cpp: 186 too many errors
我没有使用
mex -setup
为MEX设置和使用以下命令进行编译: -
mex -DWIN32 -I'D:\Softwares\MY SQL\mysql-5.6.12-win32\mysql-5.6.12-win32\include'
-L'D:\Softwares\MY SQL\mysql-5.6.12-win32\mysql-5.6.12-win32\lib' -llibmysql mysql.cpp
任何帮助非常感谢!
尝试'MEX -setup C++'?它确实看起来像被调用的编译器是一个严格的'C'编译器 - 例如,'C'不允许默认参数。你有'mex'命令的** full **输出,它包含了执行构建时'mex'传递给Windows的命令行吗? –
这是我得到的错误信息的最后一行: - D:\ MATLAB〜2 \ BIN \ MEX.PL:错误:编译'mysql.cpp'失败。我认为你(@Dan Nissenbaum)说它试图用C编译器进行编译。编译MEX -setup在列表只LCC-将Win32 C 2.4.1在d:\ MATLAB〜2 \ SYS \ LCC –
我想我还需要安装C++编译器的'MEX -setup C++''说d:\ MATLAB〜2 \ BIN \ MEX.PL:错误:“C++”不found.' –