GPU 렌더링 파티클 시스템을 만들려고하는데이 입력 클래스를 사용하여 마우스/키보드 입력을 처리합니다.DX11 DirectInput8 LNK2019 오류가 발생합니다.
문제는 줄입니다.
으로 인해 LNK2019 : 해결되지 않은 외부 기호 오류가 발생합니다. 필요한 파일을 포함 시켰으므로 왜 이런 일이 일어나고 있는지 확신 할 수 없습니다. 아래는 각각 Input.h
및 파일입니다.
INPUT.H
파일
#ifndef _INPUT_
#define _INPUT_
#include <stdafx.h>
#include <dinput.h>
class Input{
private:
IDirectInputDevice8* _DIKeyboard;
IDirectInputDevice8* _DIMouse;
LPDIRECTINPUT8 _directInput;
LONG _mouseXabsolute, _mouseYabsolute, _mouseZabsolute;
LONG _mouseXrelative, _mouseYrelative, _mouseZrelative;
BYTE _keyboardState[256];
BYTE _leftMouseButton, _rightMouseButton;
int _screenWidth, _screenHeight;
HWND _hWnd;
POINT _point;
RECT _rect;
public:
Input();
~Input();
void unload();
bool initializeInput(HINSTANCE hInstance, HWND hWnd, int screenWidth, int screenHeight);
void updateInput();
BYTE* getKeyboardState();
LONG getMouseXRelative();
LONG getMouseYRelative();
LONG getMouseZRelative();
LONG getMouseXAbsolute();
LONG getMouseYAbsolute();
LONG getMouseZAbsolute();
BYTE getLeftMouseClick();
BYTE getRightMouseClick();
};
#endif
INPUT.CPP
나는이 문제를 해결하기 위해 어떤 도움을 감사하겠습니다
#include <stdafx.h>
#include <Input.h>
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
using namespace std;
Input::Input() : _DIKeyboard(), _DIMouse(), _directInput(), _point(), _rect(){
_mouseXabsolute = _mouseYabsolute = 0;
_mouseZabsolute = 1;
_mouseXrelative = _mouseXrelative = _mouseXrelative = 0;
}
Input::~Input(){
unload();
}
void Input::unload(){
if (_DIKeyboard) _DIKeyboard->Release();
if (_DIMouse) _DIMouse->Release();
if (_directInput) _directInput->Release();
}
bool Input::initializeInput(HINSTANCE hInstance, HWND hWnd, int screenWidth, int screenHeight){
_screenWidth = screenWidth;
_screenHeight = screenHeight;
_hWnd = hWnd;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////Create direct input, keyboard and mouse devices///////////////////////////////////////////////////
HRESULT result = DirectInput8Create(hInstance, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&_directInput, NULL);
if (FAILED(result)){
MessageBox(0, L"Could not create direct input!", L"Error", MB_OK);
return false;
}
...
...
...
}
파일.
너무 링커 오류가 발생하여 .H 및 .CPP 파일은 부적절합니다. dinput8.lib –
DirectX 11을 사용하는 경우 고대 DirectInput을 사용할 필요가 없습니다. 게다가 DirectInput을 최신 버전의 Windows에서 키보드 또는 마우스 입력으로 사용하지 마십시오. Win32 메시지 위에 구현되었습니다. [DirectX Tool Kit : 지금 GamePad와 함께] (https://blogs.msdn.microsoft.com/chuckw/2014/09/05/directx-tool-kit-now-with-gamepads/) 및 [DirectX Tool Kit : 키보드 및 마우스 지원] (https://blogs.msdn.microsoft.com/chuckw/2015/08/06/directx-tool-kit-keyboard-and-mouse-support/)을 참조하십시오. –