Description:
gcc -c -g -ggdb3 -I/usr/include/mysql -D_REENTRANT -g -O2 -Wall -D_GNU_SOURCE -std=c9x -W -Wshadow -Wmissing-noreturn -Wnested-externs -Winline -Wundef -Wwrite-strings -DELM_ARCH -I/usr/include/libxml2 -Iprj/globincs -o obj/akADSCore.o /work/view2/elm/generics/common/trunk/akADS/current//src/akADSCore.c
In file included from /work/view2/elm/generics/common/trunk/akADS/current/inc/akADSCore_impl.h:27,
from prj/globincs/akADSCore_impl.h:1,
from /work/view2/elm/generics/common/trunk/akADS/current/src/akADSCore.c:22:
/usr/include/mysql/my_global.h:491: error: redefinition of `my_socket'
/usr/include/mysql/mysql.h:52: error: `my_socket' previously declared here
The problem is that there are definition guars around the typedefs, but they have different names. To wit:
in mysql.h we have.....
#ifndef my_socket_defined
#ifdef __WIN__
#define my_socket SOCKET
#else
typedef int my_socket;
#endif /* __WIN__ */
#endif /* my_socket_defined */
while in my_global.h there is:
#ifndef Socket_defined
typedef int my_socket; /* File descriptor for sockets */
#define INVALID_SOCKET -1
#endif
We are using gcc as you see above. The specific version is 3.3.4.
mysql -v: mysql Ver 14.9 Distrib 5.0.4-beta, for pc-linux-gnu (i686
How to repeat:
compile any application which includes mysql.h and my_global.h using -Wall and the other -W flags shown above.
Suggested fix:
Use consistent guard token names.