所以我試圖把我的遊戲分成多個文件。我得到這些錯誤:C++鏈接器錯誤
1>item.obj : error LNK2005: "private: static class sf::Image ctile::itile" ([email protected]@@[email protected]@@A) already defined in character.obj
1>item.obj : error LNK2005: "class cmap maps" ([email protected]@[email protected]@A) already defined in character.obj
1>item.obj : error LNK2005: "class cmainchar mainch" ([email protected]@[email protected]@A) already defined in character.obj
1>item.obj : error LNK2005: "class citemmanager itemmanager" ([email protected]@[email protected]@A) already defined in character.obj
1>item.obj : error LNK2005: "private: static class sf::Image citem::iitem" ([email protected]@@[email protected]@@A) already defined in character.obj
1>item.obj : error LNK2005: "private: static class sf::Image cspell::ispell" ([email protected]@@[email protected]@@A) already defined in character.obj
1>item.obj : error LNK2005: "class sf::RenderWindow App" ([email protected]@[email protected]@@A) already defined in character.obj
1>item.obj : error LNK2005: "class sf::View View" ([email protected]@[email protected]@A) already defined in character.obj
1>main.obj : error LNK2005: "private: static class sf::Image ctile::itile" ([email protected]@@[email protected]@@A) already defined in character.obj
1>main.obj : error LNK2005: "class cmap maps" ([email protected]@[email protected]@A) already defined in character.obj
1>main.obj : error LNK2005: "class cmainchar mainch" ([email protected]@[email protected]@A) already defined in character.obj
1>main.obj : error LNK2005: "class citemmanager itemmanager" ([email protected]@[email protected]@A) already defined in character.obj
1>main.obj : error LNK2005: "private: static class sf::Image citem::iitem" ([email protected]@@[email protected]@@A) already defined in character.obj
1>main.obj : error LNK2005: "private: static class sf::Image cspell::ispell" ([email protected]@@[email protected]@@A) already defined in character.obj
1>main.obj : error LNK2005: "class sf::RenderWindow App" ([email protected]@[email protected]@@A) already defined in character.obj
1>main.obj : error LNK2005: "class sf::View View" ([email protected]@[email protected]@A) already defined in character.obj
1>map.obj : error LNK2005: "private: static class sf::Image ctile::itile" ([email protected]@@[email protected]@@A) already defined in character.obj
1>map.obj : error LNK2005: "class cmap maps" ([email protected]@[email protected]@A) already defined in character.obj
1>map.obj : error LNK2005: "class cmainchar mainch" ([email protected]@[email protected]@A) already defined in character.obj
1>map.obj : error LNK2005: "class citemmanager itemmanager" ([email protected]@[email protected]@A) already defined in character.obj
1>map.obj : error LNK2005: "private: static class sf::Image citem::iitem" ([email protected]@@[email protected]@@A) already defined in character.obj
1>map.obj : error LNK2005: "private: static class sf::Image cspell::ispell" ([email protected]@@[email protected]@@A) already defined in character.obj
1>map.obj : error LNK2005: "class sf::RenderWindow App" ([email protected]@[email protected]@@A) already defined in character.obj
1>map.obj : error LNK2005: "class sf::View View" ([email protected]@[email protected]@A) already defined in character.obj
1>spell.obj : error LNK2005: "private: static class sf::Image ctile::itile" ([email protected]@@[email protected]@@A) already defined in character.obj
1>spell.obj : error LNK2005: "class cmap maps" ([email protected]@[email protected]@A) already defined in character.obj
1>spell.obj : error LNK2005: "class cmainchar mainch" ([email protected]@[email protected]@A) already defined in character.obj
1>spell.obj : error LNK2005: "class citemmanager itemmanager" (?it[email protected]@[email protected]@A) already defined in character.obj
1>spell.obj : error LNK2005: "private: static class sf::Image citem::iitem" ([email protected]@@[email protected]@@A) already defined in character.obj
1>spell.obj : error LNK2005: "private: static class sf::Image cspell::ispell" ([email protected]@@[email protected]@@A) already defined in character.obj
1>spell.obj : error LNK2005: "class sf::RenderWindow App" ([email protected]@[email protected]@@A) already defined in character.obj
1>spell.obj : error LNK2005: "class sf::View View" ([email protected]@[email protected]@A) already defined in character.obj
與其開始* *您的遊戲*,我建議嘗試採取一個簡單的「hello world」風格的應用程序,並將其分成兩個或多個文件。這樣你可以(a)在這裏發佈代碼作爲例子,並且(b)更容易理解重要的概念。我們無法幫助您僅使用錯誤消息列表來調試代碼。 – 2010-12-04 23:09:25