Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/143.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ ';int8#t';:尝试将mysql cpp连接器连接到visual studio 2010时,config.h中出现重新定义错误_C++_Visual Studio 2010_Connector - Fatal编程技术网

C++ ';int8#t';:尝试将mysql cpp连接器连接到visual studio 2010时,config.h中出现重新定义错误

C++ ';int8#t';:尝试将mysql cpp连接器连接到visual studio 2010时,config.h中出现重新定义错误,c++,visual-studio-2010,connector,C++,Visual Studio 2010,Connector,这是尝试使用visual studio编译我的文件时生成的完整错误报告。编译后的文件是在网络中找到的示例代码。它使用非常基本的方法直接连接到mysql数据库 错误输出: > 1>------ Build started: Project: mysql-sample, Configuration: Debug > x64 ------ 1>Build started 16/06/2012 22:49:55. 1>PrepareForBuild: 1> >

这是尝试使用visual studio编译我的文件时生成的完整错误报告。编译后的文件是在网络中找到的示例代码。它使用非常基本的方法直接连接到mysql数据库

错误输出:

> 1>------ Build started: Project: mysql-sample, Configuration: Debug
> x64 ------ 1>Build started 16/06/2012 22:49:55. 1>PrepareForBuild: 1> 
> Creating directory "c:\users\rupertt aryeen wind\documents\visual
> studio 2010\Projects\mysql-sample\x64\Debug\".
> 1>InitializeBuildStatus: 1>  Creating
> "x64\Debug\mysql-sample.unsuccessfulbuild" because "AlwaysCreate" was
> specified. 1>ClCompile: 1>  stdafx.cpp 1>  mysql-sample.cpp
> 1>c:\program files\mysql\connector c++ 1.1.0\include\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:\Program Files\MySQL\Connector C++ 1.1.0\include\mysql_connection.h(156):
> warning C4251: 'sql::mysql::MySQL_Connection::proxy' : class
> 'boost::shared_ptr<T>' needs to have dll-interface to be used by
> clients of class 'sql::mysql::MySQL_Connection' 1>          with 1>   
> [ 1>              T=sql::mysql::NativeAPI::NativeConnectionWrapper 1> 
> ] 1>C:\Program Files\MySQL\Connector C++
> 1.1.0\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:\program files\mysql\connector c++ 1.1.0\include\cppconn\config.h(60): error
> C2371: 'int8_t' : redefinition; different basic types 1>         
> C:\Program Files (x86)\Microsoft Visual Studio
> 10.0\VC\include\stdint.h(17) : see declaration of 'int8_t' 1>c:\program files\mysql\connector c++
> 1.1.0\include\cppconn\config.h(60): error C2371: 'int8_t' : redefinition; different basic types 1>          C:\Program Files
> (x86)\Microsoft Visual Studio 10.0\VC\include\stdint.h(17) : see
> declaration of 'int8_t' 1> 1>Build FAILED. 1> 1>Time Elapsed
> 00:00:12.92
> ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
>1>----构建已启动:项目:mysql示例,配置:调试
>x64------1>构建已开始于2012年6月16日22:49:55。1> PrepareForBuild:1>
>正在创建目录“c:\users\rupertt aryeen wind\documents\visual
>studio 2010\Projects\mysql sample\x64\Debug\”。
>1>初始化BuildStatus:1>创建
>“x64\Debug\mysql sample.unsuccessfulbuild”,因为“AlwaysCreate”是
>指定的。1> ClCompile:1>stdafx.cpp1>mysql-sample.cpp
> 1 > C:\程序文件\MySQL \连接器C++ +1.0包含\qLStord.h(36):
>警告C4251:“sql::SQLString::realStr”:类
>“std::basic_string”需要具有指向的dll接口
>类为“sql::SQLString”1>且具有1>
>[1>元素=字符,1>
>特征=STD::字符特征,1>AX= STD:分配器1>1>C:\程序文件\MySQL \连接器C++ +1.0包括\ myqLy连接。h(156):
>警告C4251:“sql::mysql::mysql\U连接::代理”:类
>“boost::shared_ptr”需要有dll接口供
>“sql::mysql::mysql\U连接”1>类的客户端,具有1>
>[1>T=sql::mysql::NativeAPI::NativeConnectionWrapper 1>
> 1 > C:\程序文件\ mysql \连接器C++
>1.1.0\include\cppcon/exception.h(59):警告C4251:'sql::SQLException::sql_state':类
>“std::basic_string”需要具有指向的dll接口
>由类为“sql::SQLException”1>且具有1>
>[1>元素=字符,1>
>特征=STD::字符特征,1>AX= STD:分配器1>1>C:\程序文件\MySQL \连接器C++ +1.0包含\CPPPCON\CONFIG.H(60):错误
>C2371:“int8_t”:重新定义;不同的基本类型1>
>C:\ProgramFiles(x86)\Microsoft Visual Studio
> 10 \vc\\\stdit.h(17):参见“It8t t”1>c:\\程序文件\mysql \连接器C++
>1.1.0\include\cppcon\config.h(60):错误C2371:“int8\u t”:重新定义;不同的基本类型1>C:\程序文件
>(x86)\Microsoft Visual Studio 10.0\VC\include\stdint.h(17):请参阅
>“int8_t”1>1>生成的声明失败。1> 1>经过的时间
> 00:00:12.92
>======生成:0成功,1失败,0最新,0跳过==========

看起来您应该能够通过在项目设置中设置以下宏定义来解决此问题:

HAVE_INT8_T=1
如果使用命令行,也可以使用
/DHAVE\u INT8\u T=1

实际上,您可能应该在项目中设置以下宏定义:

HAVE_STDINT_H=1
CPPCONN_DONT_TYPEDEF_MS_TYPES_TO_C99_TYPES=1
这将使MySQL连接器头仅依赖于C99整数类型名的
stdint.h
,而不是试图自己定义其中任何一个。

相关: