那麼我的問題很簡單,我得到了以下包括:stdafx.h中和MySQL
#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包括其中_WIN32_WINNT定義targetver.h,並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
我一種新的關於這些問題包括,謝謝!
從「my_global.h」中刪除定義?沒有理由兩次定義這個宏。 – jahhaj 2012-07-29 06:17:33
但是,這將適用於my_global.h文件,如果我想在其他未定義_WIN32_WINNT的項目上使用它,將是一個問題。我認爲這不是一個優雅的解決方案,但它的一個大聲笑 – ffenix 2012-07-29 06:18:57
引用自己早前的問題,「聽你的編譯器」。你被告知你需要知道的一切。它總會給你一個錯誤代碼參考,它可以在許多網站(MSDN)上查看。它也會在你的案例中引用'(24)'或'(195)'這一行,你很可能會推斷出你面臨的問題。 – ChiefTwoPencils 2012-07-29 06:19:43