1

好吧,我的问题很简单,我得到了以下内容:

#include "stdafx.h"
#include "my_global.h"
#include "mysql.h"
#include "ServerManager.h"
#include "GamePlay.h"

#pragma comment(lib, "libmysql.lib")

我得到了警告(这很烦人):

1>c:\program files\mysql\connector c 6.0.2\include\config-win.h(24): warning C4005: '_WIN32_WINNT' : macro redefinition
1>          c:\program files\windows kits\8.0\include\shared\sdkddkver.h(195) : see previous definition of '_WIN32_WINNT'

所以我检查 stdafx 包括 targetver.h ,其中定义了_WIN32_WINNT,而 my_global.h 还包括_WIN32_WINNT,我该怎么办?

这正是 my_global.h 文件的冲突部分,它是 MySQL C 库的一部分:

/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; version 2 of the License.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

/* Defines for Win32 to make it compatible for MySQL */

#define BIG_TABLES

/* 
  Minimal version of Windows we should be able to run on.
  Currently Windows 2000
*/
#define _WIN32_WINNT     0x0500

对于包括问题在内的问题,我有点陌生,谢谢!

4

2 回答 2

1

我建议对 my_global.h 进行以下修改,替换

/* 
  Minimal version of Windows we should be able to run on.
  Currently Windows 2000
*/
#define _WIN32_WINNT     0x0500

/* 
  Minimal version of Windows we should be able to run on.
  Currently Windows 2000
*/
#if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0500
#error "MySQL requires Windows 2000 or later"
#elif !defined(_WIN32_WINNT)
#define _WIN32_WINNT     0x0500
#endif

也许我错过了一些东西,但我认为 MySQL 真的很差。

于 2012-07-29T06:56:13.577 回答
0

在更好地理解问题之后,似乎my_global.h设置了您的 Windows 环境以与 MySQL 一起使用。既然是这种情况,我将停止使用targetver.h. 我假设您正在使用预编译的标头,因为这是唯一stdafx.h生成的时间。我建议制作一个没有预编译头文件或删除targetver.h. 有关更多详细信息,请参见此处

于 2012-07-29T06:18:10.247 回答