首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >stdafx.h和MySQL

stdafx.h和MySQL
EN

Stack Overflow用户
提问于 2012-07-29 06:08:34
回答 2查看 377关注 0票数 1

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

代码语言:javascript
复制
#include "stdafx.h"
#include "my_global.h"
#include "mysql.h"
#include "ServerManager.h"
#include "GamePlay.h"

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

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

代码语言:javascript
复制
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包含this .h,其中定义了_WIN32_WINNT,my_global.h还包括_WIN32_WINNT,我能对此做些什么呢?

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

代码语言:javascript
复制
/* 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

对于那些包括问题在内的问题,我是有点新的,谢谢!

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-07-29 06:56:13

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

代码语言:javascript
复制
/* 
  Minimal version of Windows we should be able to run on.
  Currently Windows 2000
*/
#define _WIN32_WINNT     0x0500

使用

代码语言:javascript
复制
/* 
  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真的很差。

票数 1
EN

Stack Overflow用户

发布于 2012-07-29 06:18:10

在更好地理解了这个问题之后,my_global.h似乎将您的windows环境设置为与MySQL一起使用。由于这种情况,我将停止使用targetver.h。我假设您使用的是预编译头,因为这是生成stdafx.h的唯一一次。我建议在没有预编译头的情况下制作一个项目或者删除targetver.h。有关更多详细信息,请参阅here

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11707097

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档