Question

My application uses the MySQL/C++ Connector which includes config.h that goes like below.

// ...
#if !defined(HAVE_INT8_T) && defined(HAVE_MS_INT8)
typedef __int8          int8_t;
#endif
// ...

Since I'm using VC++ 2010 with MSVCR100, my application also includes stdint.h that goes..

/* TYPE DEFINITIONS */
typedef signed char int8_t;
typedef short int16_t;
typedef int int32_t;
// ...

The two int8_t makes this collision compile error.

I did some google reserarch but no one seems to know the perfect solution to this.

Any helps would be appreciated.

Thanks in adavance.

Was it helpful?

Solution

Did you try #define HAVE_INT8_T (and similar, I guess the same happens for other types) before including the MySQL header?

I.e. something like

...
#define HAVE_INT8_T
#include "MySQL.h"
...

EDIT: If MySQL.h includes something like a "config.h", which screws up things again, you could try to directly include that config.h, then adjust the incorrect defines, then include the MySQL.h. There'll probably be an include guard around the config.h to prevent it from being included again.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top