2013-05-15 139 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