【问题标题】:Compiling MySQL Connector with Visual Studio 2015 Win64使用 Visual Studio 2015 Win64 编译 MySQL 连接器
【发布时间】:2016-03-09 13:29:05
【问题描述】:

使用 cmake 创建解决方案后,我在构建过程中遇到了 Visual Studio 中的 1400 个错误。 主要问题是,似乎没有人编译连接器,而只是将预编译的库用于他们的项目,在 Windows 上更是如此。 以下是一些错误,似乎 timespec 又被重新定义了一次,首先是在 .h 中,然后是第二次在 my_global.h 中,错误和定义如下。

所以问题是,我到底该如何修复 1400 错误?

或者至少,一些如何摆脱重新定义的建议会很棒!

时间.h #ifndef _CRT_NO_TIME_T 结构时间规范 { time_t 电视秒; // 秒 - >= 0 长 tv_nsec; // 纳秒 - [0, 999999999] }; #万一 my_global.h

 struct timespec {
    union ft64 tv;
    /* The max timeout value in millisecond for native_cond_timedwait */
    long max_timeout_msec;
 };

错误 C2011 'timespec': 'struct' 类型重新定义(编译源文件 C:\Users\DDubinin\Downloads\mysql-connector-c-6.1.6-src\mysys\my_mess.c)mysys c:\users \ddubinin\downloads\mysql-connector-c-6.1.6-src\include\my_global.h 660

错误 C2039 'tv': is not a member of 'timespec' (编译源文件 C:\Users\DDubinin\Downloads\mysql-connector-c-6.1.6-src\mysys\my_malloc.c) mysys c :\users\ddubinin\downloads\mysql-connector-c-6.1.6-src\include\my_global.h 681

'->tv' 左侧的错误 C2227 必须指向类/结构/联合/通用类型(编译源文件 C:\Users\DDubinin\Downloads\mysql-connector-c-6.1.6-src\libmysql\ authentication_win\handshake.cc) auth_win_client c:\users\ddubinin\downloads\mysql-connector-c-6.1.6-src\include\my_global.h 681

'->max_timeout_msec' 左侧的错误 C2227 必须指向类/结构/联合/通用类型(编译源文件 C:\Users\DDubinin\Downloads\mysql-connector-c-6.1.6-src\libmysql\ authentication_win\plugin_client.cc) auth_win_client c:\users\ddubinin\downloads\mysql-connector-c-6.1.6-src\include\my_global.h 682

【问题讨论】:

  • 实际上,我下载了 MySQL Connector C++ 的源代码并在我的 PC 上构建了源代码。请记住,您必须注意整个项目是 64 位或整个项目是 32 位。使用Dependency Checker 验证 DLL。
  • 我建议从 MySQL 站点而不是 GitHub 下载源代码。
  • 忘了澄清,我需要 MySQL Connector/C,而不是 C++。
  • 而 github 链接是 MySQL 网站的镜像,供那些想看代码但不会花时间下载它的人使用。

标签: c++ mysql c visual-studio-2015 redefinition


【解决方案1】:

我使用了 mysql 服务器代码(即 mysql-5.7.13.zip)并从中编译了 MySQL Connector/C。

【讨论】:

    【解决方案2】:

    我将关闭此问题,设法使用较旧的 VS2013 x64 版本的 Visual Studio 和 CMake 4.3.1 编译源...

    看来,Visual Studio 2015 中的新变化正在破坏 C 连接器源代码,我希望 MySQL 团队在未来的版本中修复这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-02-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-25
      • 2017-10-05
      • 2016-03-12
      相关资源
      最近更新 更多