tags:

views:

421

answers:

3

Hello there...

The problem is that the compiler says that there is a redefinition of a function between a library that belongs to MySQL and math.h from the std library.

I have been over this for two days and I still can't figure it out.

Has this ever happened to anyone?

This is the output from the compiler


C:\mingw\bin\mingw32-make.exe all 
'Building file: ../src/interfaz/ventanaconf.cpp'
'Invoking: GCC C++ Compiler'
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"
In file included from c:/Archivos de programa/MySQL/MySQL Server 5.0/include/my_global.h:73,
                 from ../src/interfaz/../gestiondb/gestordb.h:6,
                 from ../src/interfaz/../gestiondb/operacionesdb.h:5,
                 from ../src/interfaz/ventanamodulos.h:20,
                 from ../src/interfaz/ventanaconf.h:27,
                 from ../src/interfaz/ventanaconf.cpp:1:
c:/Archivos de programa/MySQL/MySQL Server 5.0/include/config-win.h: **In function `double rint(double)':
c:/Archivos de programa/MySQL/MySQL Server 5.0/include/config-win.h:228: error: redefinition of `double rint(double)'
C:/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/math.h:620: **error: `double rint(double)' previously defined here**
C:\mingw\bin\mingw32-make.exe: *** [src/interfaz/ventanaconf.o] Error 1**


Thanks in advance!!!

A: 

In line 228 of c:/Archivos de programa/MySQL/MySQL Server 5.0/include/config-win.h you should find a declaration/definition of function named "rint". In line 620 of C:/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/math.h you should find another definition of a function with the same name (which probably even does the same).

To solve the problem you will have to delete/outcomment/undefine one of these definitions.

Be prepared to get a similar problem when linking, if you also link two libraries with the same function.

TToni
+2  A: 

This thread in the mysql support area seems to indicate that they've taken the definition of rint() out of their config_win.h file as of April this year (even though the patch was proposed in 2006). Are you using a version of the MySQL source newer than that?

Adam Bellaire
I just tried this solution and is not working... I was using an old realese of MySQL, but 5.0.51, but after downloading the sources of 5.0.67 I am getting the same.
pabloh84
Well, I think the issue is that config-win.h was designed to implement rint() because most Windows machines had buggy rounding behavior. However, it looks like you're using mingw/gcc, so you have the same rint() as any *nix system. ... Not sure what to do to resolve the issue.
Adam Bellaire
+1  A: 

The problem was about an included library, which linux simply ignores, but windows want out. There is no problem letting it out in linux neither...

Somedays i feel SOOOOOOOOOOOOOOOOOOOOOOO STUPID:..

pabloh84