Description:
Hi
On a Cygwin system
[FrancisANDRE@idefix testsuite ]$uname -a
CYGWIN_NT-6.1-WOW idefix 2.5.1(0.297/5/3) 2016-04-21 22:12 i686 Cygwin
with MySQL
Cannot compile a MySQL client c++ source code
/usr/include/mysql/my_global.h:971:9: erreur: ‘ulong’ does not name a type
typedef ulong nesting_map; /* Used for flags of nesting constructs */
^
In file included from /usr/include/mysql/my_global.h:1039:0,
from src/SQLExecutor.cpp:38:
/usr/include/mysql/my_dbug.h:37:3: erreur: ‘uint’ does not name a type
uint level; /* this nesting level, highest bit enables tracing */
^
/usr/include/mysql/my_dbug.h:54:64: erreur: ‘uint’ has not been declared
extern void _db_enter_(const char *_func_, const char *_file_, uint _line_,
^
/usr/include/mysql/my_dbug.h:56:26: erreur: variable or field ‘_db_return_’ declared void
extern void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_);
^
/usr/include/mysql/my_dbug.h:56:26: erreur: ‘uint’ was not declared in this scope
/usr/include/mysql/my_dbug.h:56:39: erreur: expected primary-expression before ‘struct’
extern void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_);
^
/usr/include/mysql/my_dbug.h:57:25: erreur: variable or field ‘_db_pargs_’ declared void
extern void _db_pargs_(uint _line_,const char *keyword);
^
/usr/include/mysql/my_dbug.h:57:25: erreur: ‘uint’ was not declared in this scope
/usr/include/mysql/my_dbug.h:57:37: erreur: expected primary-expression before ‘const’
extern void _db_pargs_(uint _line_,const char *keyword);
^
/usr/include/mysql/my_dbug.h:60:24: erreur: variable or field ‘_db_dump_’ declared void
extern void _db_dump_(uint _line_,const char *keyword,
^
/usr/include/mysql/my_dbug.h:60:24: erreur: ‘uint’ was not declared in this scope
/usr/include/mysql/my_dbug.h:60:36: erreur: expected primary-expression before ‘const’
extern void _db_dump_(uint _line_,const char *keyword,
^
/usr/include/mysql/my_dbug.h:61:24: erreur: expected primary-expression before ‘const’
const unsigned char *memory, size_t length);
^
/usr/include/mysql/my_dbug.h:61:60: erreur: expected primary-expression before ‘length’
const unsigned char *memory, size_t length);
^
In file included from /usr/include/mysql/mysql.h:72:0,
from src/SQLExecutor.cpp:39:
/usr/include/mysql/mysql_com.h:465:41: erreur: ‘uint’ has not been declared
void my_net_set_write_timeout(NET *net, uint timeout);
^
/usr/include/mysql/mysql_com.h:466:40: erreur: ‘uint’ has not been declared
void my_net_set_read_timeout(NET *net, uint timeout);
^
/usr/include/mysql/mysql_com.h:562:1: erreur: ‘ulong’ does not name a type
ulong STDCALL net_field_length(uchar **packet);
How to repeat:
Compile a c++ program including
#include <my_global.h>
#include <mysql.h>
Suggested fix:
The problem is coming from my_config.h which defines HAVE_ULONG
/* #undef SIZEOF_UCHAR */
/* #undef HAVE_UCHAR */
#define SIZEOF_UINT 4
#define HAVE_UINT 1
#define SIZEOF_ULONG 4
#define HAVE_ULONG 1
/* #undef SIZEOF_INT8 */
/* #undef HAVE_INT8 */
/* #undef SIZEOF_UINT8 */
/* #undef HAVE_UINT8 */
/* #undef SIZEOF_INT16 */
/* #undef HAVE_INT16 */
and in my_global.h
#if !defined(HAVE_ULONG) && !defined(__USE_MISC)
typedef unsigned long ulong; /* Short for unsigned long */
#endif