私のコードで最後のエラーを修正しようとしました。私はVS6.0をVS2008に移行しました。Visual Studio 2008 - エラーC2872: 'NPC':あいまいな記号
私の最後のエラーは私のSimpleNPC.cppファイルである:
.\SimpleNPC.cpp(216) : error C2872: 'NPC' : ambiguous symbol
could be '.\SimpleNPC.cpp(30) : NPC_Editor::NPC `anonymous-namespace'::NPC'
or 'c:\documents and settings\t411\bureau\serveur\server_rc15g\t4c server\NPC_Editor/NPC.h(27) : NPC_Editor::NPC'
ここでエラーのためのコードは次のとおりです。
case InsSendSoldItemList:{
std::list<NPC::SoldItem> itemList;
std::list<NPC::SoldItem>::iterator i;
npc->theNpc->GetSoldItemList(itemList);
CreateItemList
for(i = itemList.begin(); i != itemList.end(); i++){
AddBuyItem((*i).price, Unit::GetIDFromName((*i).itemId.c_str(), U_OBJECT, TRUE))
}
SendBuyItemList
ファイルの先頭には、次のとおりです。
// SimpleNPC.cpp: implementation of the SimpleNPC class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "TFC Server.h"
#include "SimpleNPC.h"
#include "NPCMacroScriptLng.h"
#undef Command
#include "NPC_Editor/NPC.h"
#include "NPC_Editor/Keyword.h"
#include "NPC_Editor/Command.h"
#include "NPC_Editor/IfFlow.h"
#include "NPC_Editor/Assign.h"
#include "NPC_Editor/ForFlow.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
using namespace NPC_Editor;
namespace{
typedef list< Instruction * > InstructionList;
typedef NPC_Editor::NPC NPC;
};
このファイルには次のコードがあります:
std::list<NPC_Editor::NPC::SoldItem> soldItems;
紛争が発生する理由はありますか? ありがとうございました!あなたは、名前空間の閉じ括弧で;
を必要としない
"ヘッダーファイルは...です"と書いたが、.cppファイルの内容を貼り付けた。関連するコンテンツを.cppと.hの両方に貼り付けてください。 –
はい申し訳ありませんが、それは悪い翻訳です、私は言ったかった:ここにファイルの先頭です。 –