Bug #60307 Can't compile 1.0.5 on Visual Studio 2010
Submitted: 2 Mar 2011 15:25 Modified: 9 Aug 2012 19:50
Reporter: Shereef Marzouk Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / C++ Severity:S3 (Non-critical)
Version:1.0.5 OS:Windows (Windows 7 x64)
Assigned to: Bogdan Degtyariov CPU Architecture:Any

[2 Mar 2011 15:25] Shereef Marzouk
Description:
When i try to compile on VS 2010 i get a ton of errors about redefinition i tried to put a preprocessor guard didn't work, when i commented the definition it worked

commented part:
/*
#ifdef HAVE_MS_INT8
typedef __int8			int8_t;
#endif

#ifdef HAVE_MS_UINT8
typedef unsigned __int8	uint8_t;
#endif
*/
this is error that remains:

Error	3	error C2439: 'std::_Pair_base<_Ty1,_Ty2>::first' : member could not be initialized	C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\utility	163	1	mysqlcppconn
Error	2	error C2440: 'initializing' : cannot convert from 'int' to 'char *'	C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\utility	163	1	mysqlcppconn
Warning	1	warning C4251: 'sql::SQLException::sql_state' : class 'std::basic_string<_Elem,_Traits,_Ax>' needs to have dll-interface to be used by clients of class 'sql::SQLException'	E:\Users\shereef\Downloads\mysql-connector-c++-1.0.5\cppconn\exception.h	47	1	mysqlcppconn

P.S.
i know you guys may not care about this, but 1.0.5 is cool because it doesn't require boost, and using it without compiling it on vs 2010 makes it have incompatibility with my project since my project is always compiled on vs2010 and not vs2005

How to repeat:
try to compile on VS 2010
[11 May 2011 17:18] Eric Cole
I'm able to use the precompiled lib and dll with vs 2010 if I do not #include <stdint.h>.

As soon as I include stdint.h I get the int8_t redefinition error.  So I would go further than just saying can't compile on vs 2010, can't even use the precompiled library at all if you also want to use stdint.h.

This is a problem with both version 1.0.5 and 1.1.0, so not sure why the original submitter says it works fine on version 1.0.5 because of no boost, this really has nothing to do with boost at all.
[11 May 2011 19:43] Lawrenty Novitsky
i guess 1st submitter only meant that 1.0.5 is used because it does not require boost, and not that boost has anything to do with compilation problem.

i'm afraid we won't fix anything in the 1.0.5, but for 1.1.0 that is legitimate demand.
p.s. i guess we will have to eliminate that boost dependency anyway
[30 Jan 2012 20:18] Robert Knight
I to have the need for the latest MySQL Connector/C++ on Visual Studio 2010. Has there been any progress for it?

Rob
[24 May 2012 10:36] Lawrenty Novitsky
There is a workaround for this bug - to define CPPCONN_DONT_TYPEDEF_MS_TYPES_TO_C99_TYPES in your code prior to include c/c++ headers and after including stdint.h
[9 Aug 2012 19:50] John Russell
Added to changelog for 1.1.1: 

Compiling with Visual Studio 2010 could fail with compilation errors
if the source contained a #include line. The errors were typically of
the form: cannot convert from 'type1' to 'type2'.