未解决的外部符号 - 错误在指南? [英] Unresolved External Symbol- Error in guide?

查看:127
本文介绍了未解决的外部符号 - 错误在指南?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我一直在尝试在游戏引擎SDK中修复一个奇怪的错误,其中使用Windows加载游标而不是游戏自己的游标。
这个修复是在这里: http:// www。 crydev.net/wiki/index.php/Use_Custom_Cursor#Step_1:_Fixing_The_Cursor_Bug

So I've been trying to fix a weird bug in a game engine SDK where the Windows loading cursor is used instead of the game's own cursor. The fix for this is here: http://www.crydev.net/wiki/index.php/Use_Custom_Cursor#Step_1:_Fixing_The_Cursor_Bug.

我已经按照修复,但是我在建立游戏时不断得到这些DLL:

I have followed the fix, but I keep getting these when building the game DLL:

Error   1   error LNK2019: unresolved external symbol "public: __thiscall MODCursor::MODCursor(void)" (??0MODCursor@@QAE@XZ) referenced in function "public: __thiscall CGame::CGame(void)" (??0CGame@@QAE@XZ)  C:\Users\User\Desktop\Crytek\Mods\CryEngine2\Code\Game.obj  GameDll

Error   2   error LNK2019: unresolved external symbol "public: __thiscall MODCursor::~MODCursor(void)" (??1MODCursor@@QAE@XZ) referenced in function "public: virtual __thiscall CGame::~CGame(void)" (??1CGame@@UAE@XZ)    C:\Users\User\Desktop\Crytek\Mods\CryEngine2\Code\Game.obj  GameDll

是的,通常我可以很容易地通过定义类来解决这个问题,但它已经在这种情况下不工作。我可以做错什么?

Yeah, normally I can fix this issue quite easily by defining the class properly, but it hasn't worked in this case. What can I be doing wrong?

这些文件与修补程序指南一样,所以在这里发布文件没有任何意义将浪费在这里的空间。如果文件真的需要调查这个问题,我会上传他们,如果有人要求他们。

The files are as they are in the guide for the fix, so there isn't really any point in posting the files here since they would be a waste of space on here. If the files are really needed to investigate this issue, I'll upload them if anyone requests them.

也许修复本身有错误?修复程序与我的构建有一个可能的区别是修复程序是使用Visual Studio 2008,我正在使用Visual Studio 2013。

Perhaps there's an error within the fix itself? One possible difference from the fix to my build is that the fix is using Visual Studio 2008, I am using Visual Studio 2013.

推荐答案

也许尝试把它全部放在.h文件中:

Maybe try to put it all inside .h file:

#ifndef _MOD_CURSOR
#define _MOD_CURSOR

#include <windows.h>
#include "resource.h"

#undef GetUserName // This is a macro in windows.h, gives issues with GetUserName() of ISystem

class MODCursor : public ISystemEventListener
{
public:
    MODCursor() {
        gEnv->pSystem->GetISystemEventDispatcher()->RegisterListener(this);
        m_cursor = LoadCursor((HINSTANCE)g_hInst, MAKEINTRESOURCE(IDC_CURSOR1));
        SetCursor(m_cursor);
    }
    ~MODCursor(){
        gEnv->pSystem->GetISystemEventDispatcher()->RemoveListener(this);
    }
private:
    virtual void OnSystemEvent( ESystemEvent event,UINT_PTR wparam,UINT_PTR lparam ) {
        if(event == ESYSTEM_EVENT_TOGGLE_FULLSCREEN || event == ESYSTEM_EVENT_RESIZE || event == ESYSTEM_EVENT_CHANGE_FOCUS){
            if (m_cursor != GetCursor()) 
                SetCursor(m_cursor);
        }
    }
    HCURSOR m_cursor;
};
#endif

这篇关于未解决的外部符号 - 错误在指南?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆