以前有人做过吗???
我正在尝试使用 MinGW 编译使用 MySQL 库的程序。我不断收到重新定义函数“rint”的消息。好的,该函数确实在来自 MySQL 的 config-win.h 和来自标准库的 math.h 两个文件中,但它们都应该是没有问题的库。
在打破我的头一段时间后,我什至尝试了这个,它不会编译:
#include <iostream>
#include <my_global.h>
#include <mysql.h>
using namespace std;
int main() {
cout << "Hello World!!!" << endl; // prints Hello World!!!
return 0;
}
这是命令以及我为编译而发出的输出
i586-mingw32msvc-cc -I/usr/include/mysql probando.cpp -w
In file included from /usr/include/mysql/my_global.h:73,
from probando.cpp:10:
/usr/include/mysql/config-win.h: In function ‘double rint(double)’:
/usr/include/mysql/config-win.h:229: error: redefinition of ‘double rint(double)’
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/math.h:635: error: ‘double rint(double)’ previously defined here
我已经在 WindowsXP 中使用 MinGW 进行了测试,MySQL 库在 .a 库中正确转换,在 Linux 中(输出来自 Linux,与 Windows 中几乎相同)使用 MinGW32。
人们......我没有选择......任何线索?有人以前使用过 MySQL 和 MinGW 吗?它可以与 Cygwin 一起使用吗?
如果您花时间回答,请提前致谢。