2013-05-15 98 views
0

好吧..這可能是一個愚蠢的問題。我只是遵循了關於如何製作遊戲引擎的教程。我一直在通過幾次錯誤戰鬥,終於認爲我正在陷入最後的錯誤。所以這是我的錯誤:C++遊戲。編譯時出錯代碼。錯誤LNK2019

錯誤1個錯誤LNK2019:解析外部符號 _ 小鬼 _MessageBoxA @ 16在功能上__catch $ _wWinMain引用@ 16 $ 0

錯誤2錯誤LNK2019:無法解析的外部符號「公共:__thiscall 引擎::引擎(無效) 「(?? 0Engine @@ @ QAE XZ)在函數引用 _wWinMain @ 16

錯誤3錯誤LNK2019:解析外部符號」 公共:無效 __thiscall引擎:: Go(void)「(?Go @發動機@@ QAEXXZ)函數_wWinMain引用@ 16

錯誤4錯誤LNK1120:3周無法解析的外部

代碼:

#include <Windows.h> 
#include "Engine.h" 

int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow) 
{ 
    Engine* engine = new Engine(); 

    try 
    { 
     engine->Go(); 
    } 
    catch(char* e) 
    { 
     MessageBoxA(NULL, e, "Exception Occured", MB_OK | MB_ICONERROR); 
    } 
} 

所以我還挺猜測,這是wWinMain事,我做了。但問題是什麼,我不清楚。

在此先感謝。

+2

它必須是非常糟糕的教程,如果它拋出char *作爲例外... – nogard

+0

http://www.dreamincode.net/forums/topic/230524-c-tile-engine-from-scratch-part-1/ – mads232

+0

錯誤1聽起來像你沒有鏈接到「user32.lib」 – Stowelly

回答

3
error LNK2019: unresolved external symbol [email protected] referenced in function [email protected]$0 

此錯誤表示您需要將您的項目與user32.lib鏈接。

error LNK2019: unresolved external symbol "public: __thiscall Engine::Engine(void)" ([email protected]@[email protected]) referenced in function [email protected] 
error LNK2019: unresolved external symbol "public: void __thiscall Engine::Go(void)" ([email protected]@@QAEXXZ) referenced in function [email protected] 

這些錯誤表明您需要編譯Engine.cpp並將其鏈接到您的項目中。

+0

謝謝。你能否描述如何鏈接到user32.lib? 我應該這樣做:「#include」Engine.cpp「? – mads232

+0

@ user2007556 http://bit.ly/19sKOgF – Oktalist

+0

不,不要''include' Engine.cpp。只需將它添加到您的項目的源文件。 – Oktalist