I am trying to get the MySQL C++ connector to work. I understand that the SQLString.h library has been missed out of the package as stated in the forum:
and I have downloaded it from one of the zip packages as suggested. i am only writing a very basic test code. I now get the following errors instead...
1>c:\documents and settings\mmtl\my documents\visual studio 2010\projects\mysql\sql_test\sql_test\include\cppconn\sqlstring.h(36): warning C4251: 'sql::SQLString::realStr' : class 'std::basic_string<_Elem,_Traits,_Ax>' needs to have dll-interface to be used by clients of class 'sql::SQLString'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1>c:\documents and settings\mmtl\my documents\visual studio 2010\projects\mysql\sql_test\sql_test\mysql_connection.h(156): warning C4251: 'sql::mysql::MySQL_Connection:roxy' : class 'boost::shared_ptr<T>' needs to have dll-interface to be used by clients of class 'sql::mysql::MySQL_Connection'
1>c:\documents and settings\mmtl\my documents\visual studio 2010\projects\mysql\sql_test\sql_test\include\cppconn\exception.h(59): 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'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1>c:\documents and settings\mmtl\my documents\visual studio 2010\projects\mysql\sql_test\sql_test\include\cppconn\config.h(60): error C2371: 'int8_t' : redefinition; different basic types
1> c:\program files\microsoft visual studio 10.0\vc\include\stdint.h(17) : see declaration of 'int8_t'
1>c:\documents and settings\mmtl\my documents\visual studio 2010\projects\mysql\sql_test\sql_test\include\cppconn\config.h(60): error C2371: 'int8_t' : redefinition; different basic types
1> c:\program files\microsoft visual studio 10.0\vc\include\stdint.h(17) : see declaration of 'int8_t'
I see that a couple of people have posted this before on different forums but I haven't managed to find any responses. I would really appreciate any help that anybody could give me. I am a beginner so please be patient with me!
c:\documents and settings\mmtl\my documents\visual studio 2010\projects\mysql\sql_test\sql_test\include\cppconn\config.h(60): error C2371: 'int8_t' : redefinition; different basic types
That config.h header is defining a type called int8_t.
Then you have this:
1> c:\program files\microsoft visual studio 10.0\vc\include\stdint.h(17) : see declaration of 'int8_t'
There is another int8_t defined in stdint.h. So which int8_t is supposed to be used?
That is what the compiler is telling you -- the module you're compiling is including headers that have contradicting definitions of int8_t.
Originally Posted by CodeCheck
and I have downloaded it from one of the zip packages as suggested. i am only writing a very basic test code. I now get the following errors instead...
Well, this "basic test code" is flawed, as you're including two headers that have conflicting definitions of int8_t. That config.h file isn't right, as it is trying to change what stdint.h has already defined.
Thank you for explaning this to me. However it now leaves me stuck as to how I am meant to connect C++ to MySQL...
It's not just a matter of getting a missing header file. You must make sure that you have set any required preprocessor symbols before you compile anything.
More than likely, that header file you received requires you to do something in advance that allows it to be used in a Visual C++ program. Usually there are preprocessor switches that you must set so that the source code doesn't take the wrong path of defining things that the compiler's headers have already defined.
In this case, the header believes that there is no stdint.h defined by your compiler, so defines its own version of int8_t. If you open that header, you will probably see #ifdef and #defines that makes sure that int8_t is defined only if a certain #define switch is set (or not set).
Bookmarks