"int8_t":尝试将MySQL CPP连接器连接到Visual Studio 2010时Config.h中的重新定义错误
'int8_t' : redefinition error in config.h when trying to connect mysql cpp connector to visual studio 2010
这是尝试使用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:usersrupertt aryeen winddocumentsvisual
> studio 2010Projectsmysql-samplex64Debug".
> 1>InitializeBuildStatus: 1> Creating
> "x64Debugmysql-sample.unsuccessfulbuild" because "AlwaysCreate" was
> specified. 1>ClCompile: 1> stdafx.cpp 1> mysql-sample.cpp
> 1>c:program filesmysqlconnector c++ 1.1.0includesqlstring.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 FilesMySQLConnector C++ 1.1.0includemysql_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 FilesMySQLConnector C++
> 1.1.0includecppconn/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 filesmysqlconnector c++ 1.1.0includecppconnconfig.h(60): error
> C2371: 'int8_t' : redefinition; different basic types 1>
> C:Program Files (x86)Microsoft Visual Studio
> 10.0VCincludestdint.h(17) : see declaration of 'int8_t' 1>c:program filesmysqlconnector c++
> 1.1.0includecppconnconfig.h(60): error C2371: 'int8_t' : redefinition; different basic types 1> C:Program Files
> (x86)Microsoft Visual Studio 10.0VCincludestdint.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 ==========
看起来您应该能够通过在项目设置中设置以下宏定义来解决此问题:
HAVE_INT8_T=1
或者/DHAVE_INT8_T=1
如果您使用的是命令行。
实际上,您可能应该在项目中设置以下宏定义:
HAVE_STDINT_H=1
CPPCONN_DONT_TYPEDEF_MS_TYPES_TO_C99_TYPES=1
这应该使MySQL连接器标头仅依赖于C99整数类型名的stdint.h
,而不是尝试自行定义其中任何一个。
相关文章:
- 编译 llvm 插件时出现问题:llvm/Config/llvm-config.h:没有这样的文件或目录
- 将代码从 32 位迁移到 64 位时出现问题 Visual Studio 2010
- 如何解决错误 C2719 在 Visual Studio 2010 C++ 中不存在代码行时
- 当 pkg-config 不能解决 opencv 'undefined reference'编译问题时,如何解决它?
- 创建 ./config.data 在编译 Mozilla Firefox 时失败
- 在Visual Studio 2010 c ++中调试时出现奇怪的异常
- 字符串以使用SQLAPI(Visual Studio 2010)时出现错误LNK2019
- 为什么当我在Visual c ++ studio 2010中运行应用程序时光标会转到最后一个文本框
- 从 Visual Studio 2010 迁移到 2012 时C++11 问题
- 尝试使用Visual Studio 2010调试DLL(C )时的错误消息
- VC++ 2010:从 VC6++ 转换后显示打开对话框时出错
- Visual Studio 2010 与 2012 编译时性能和稳定性比较,适用于C++用户
- 在MS Visual Studio 2010上使用带有Cuda互操作的OpenGL缓冲区时出现异常错误
- Visual Studio 2013 在使用 VS 2010 平台工具集时找不到头文件
- boost::bind 在 VC++ 2010 中绑定引发异常的函数时不起作用
- 在MSVC 2010上使用bjam构建Boost 1.50时出错
- 当向量被破坏且_ITERATOR_DEBUG_LEVEL=0时,为什么Visual C++2010仍在调用Orphan_
- "int8_t":尝试将MySQL CPP连接器连接到Visual Studio 2010时Config.h中的重新定义错误
- 使用 Visual Studio 2010 时,Boost 1.45 - 1.49 会中断 MySql C++ Conn
- 使用Visual Studio 2010时,在将调试器附加到程序时看不到托管变量名