使用 cmake 创建解决方案后,我在构建过程中在 Visual Studio 中遇到了 1400 个错误。 主要问题是,似乎没有人编译连接器,而只是将预编译库用于他们的项目,在 Windows 上更是如此。 这里有一些错误,似乎 timespec 被重新定义了一次,首先在 ,然后在 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':不是'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 必须指向 class/struct/union/generic 类型(编译源文件 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 必须指向 class/struct/union/generic 类型(编译源文件 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
最佳答案
我将关闭此问题,设法使用较旧的 VS2013 x64 版本的 Visual Studio 和 CMake 4.3.1 来编译源代码...
看来,Visual Studio 2015 中的新变化正在破坏 C 连接器源代码,我希望 MySQL 团队在未来的版本中修复此问题。
关于c++ - 使用 Visual Studio 2015 Win64 编译 MySQL Connector,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34091321/