【问题标题】:Problem with conflict between mysql and math.hmysql和math.h之间的冲突问题
【发布时间】:2008-10-07 15:59:53
【问题描述】:

问题是编译器说在属于 MySQL 的库和 std 库中的 math.h 之间有一个函数的重新定义。

我已经解决了两天了,但我仍然无法弄清楚。

有人遇到过这种情况吗?

这是编译器的输出


C:\mingw\bin\mingw32-make.exe 全部 '构建文件:../src/interfaz/ventanaconf.cpp' '调用:GCC C++ 编译器' C:\mingw\bin\mingw32-g++.exe -mms-bitfields -I"c:\dev-cpp\gtkmm\include\gtkmm-2.4" -I"c:\dev-cpp\gtkmm\lib\gtkmm-2.4\include" -I"c:\dev-cpp\gtkmm\include\glibmm-2.4" -I"c:\dev-cpp\gtkmm\lib\glibmm-2.4\include" -I"c:\dev-cpp\gtkmm\include\gdkmm-2.4" -I"c:\dev-cpp\gtkmm\lib\gdkmm-2.4\include" -I"c:\dev-cpp\gtkmm\include\pangomm-1.4" -I"c:\dev-cpp\gtkmm\include\atkmm-1.6" -I"c:\dev-cpp\gtkmm\include\sigc++-2.0" -I"c:\dev-cpp\gtkmm\lib\sigc++-2.0\include" -I"c:\dev-cpp\gtkmm\include\cairomm-1.0" -I"c:\gtk\include\gtk-2.0" -I"c:\gtk\include\glib-2.0" -I"c:\gtk\lib\glib-2.0\include" -I"c:\gtk\lib\gtk-2.0\include" -I"c:\gtk\include\pango-1.0" -I"c:\gtk\include\cairo" -I"c:\gtk\include\freetype2" -I"c:\gtk\include" -I"c:\gtk\include\atk-1.0" -I"c:\Archivos de programa\MySQL\MySQL Server 5.0\include" -O0 -g3 -w -c -fmessage-length=0 -MMD -MP -MF"src/interfaz/ventanaconf.d" -MT“src/interfaz/ventanaconf.d” -o"src/interfaz/ventanaconf.o" "../src/interfaz/ventanaconf.cpp" 在 c:/Archivos de programa/MySQL/MySQL Server 5.0/include/my_global.h:73 包含的文件中, 来自../src/interfaz/../gestiondb/gestordb.h:6, 来自../src/interfaz/../gestiondb/operacionesdb.h:5, 来自../src/interfaz/ventanamodulos.h:20, 来自../src/interfaz/ventanaconf.h:27, 来自../src/interfaz/ventanaconf.cpp:1: c:/Archivos de programa/MySQL/MySQL Server 5.0/include/config-win.h: **在函数`double rint(double)'中: c:/Archivos de programa/MySQL/MySQL Server 5.0/include/config-win.h:228: 错误:重新定义`double rint(double)' C:/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/math.h:620: **错误: `double rint(double) ' 之前在这里定义过** C:\mingw\bin\mingw32-make.exe: *** [src/interfaz/ventanaconf.o] 错误 1**

提前致谢!!!

【问题讨论】:

    标签: mysql math.h


    【解决方案1】:

    mysql 支持区域中的This thread 似乎表明,截至今年 4 月,他们已经从 config_win.h 文件中删除了 rint() 的定义(尽管该补丁是在 2006 年提出的)。您使用的 MySQL 源版本是否比该版本更新?

    【讨论】:

    • 我刚刚尝试了这个解决方案,但没有用......我使用的是 MySQL 的旧版本,但是 5.0.51,但在下载 5.0.67 的源代码后,我得到了相同的结果。
    • 好吧,我认为问题在于 config-win.h 旨在实现 rint() 因为大多数 Windows 机器都有错误的舍入行为。但是,看起来您正在使用 mingw/gcc,因此您拥有与任何 *nix 系统相同的 rint()。 ...不知道如何解决这个问题。
    【解决方案2】:

    问题在于包含的库,Linux 简单地忽略了它,但 Windows 想要退出。在linux中放出来也没问题...

    有时候我觉得 SOOOOOOOOOOOOOOOOOOOOOOO 愚蠢:..

    【讨论】:

      【解决方案3】:

      在 c:/Archivos de programa/MySQL/MySQL Server 5.0/include/config-win.h 的第 228 行中,您应该找到名为“rint”的函数的声明/定义。在 C:/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/math.h 的第 620 行中,您应该找到另一个函数定义相同的名称(甚至可能相同)。

      要解决问题,您必须删除/取消注释/取消定义这些定义之一。

      如果您还链接两个具有相同功能的库,请准备在链接时遇到类似问题。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-10-23
        • 2014-12-13
        • 1970-01-01
        • 2023-03-11
        • 2012-06-27
        • 2012-03-06
        • 2011-05-02
        • 2012-11-25
        相关资源
        最近更新 更多