Original Post
Hello all..
Alright.. I have a really really nice direct input class, and all seems to be going.. somewhat alright, but I have a few problems.
First of all, when I first compiled my program and ran it, it worked fine and i could use the mouse and keyboard. However, when I shut down my program failed and i got some sort of error in VS.net that directed me to some sort of disassembly.. stuff. Anyway, I thought that it probably had something to do with me not releasing my objects.. or soemthign like that.. anyway. This was kind of a problem when I was making some D3D classes, but most of the time i just had to rearrange the way that I released my interface (ie, release it before clearing other non-related arrays). Anyway, I went to just change some stuff around in my destructor, compiled, and got a couple of linker errors..
I''m not sure what I changed, as far as I know i just commented out a couple of lines. So, I uncommented them, and still got the error. So.. after a day of trying to figure out what might have gone wrong, I''ve decided that I need help..
I feel kinda bad, because just yesterday I had a another linker error, but oh well.. if someone really has a problem with me posting than I guess they''ll tell me.
Anyway, this is the error I''m getting:
DI_cincludes.h (just includes files that include common header files and libs)
DI_includes.h (includes common header files and libs)
Eh.. I know thats a lot to go through.. hopefully its something really stupid that I accidentally erased/added.. such as an extra braket or something.. i don''t know >.<
Thanks in advance!!
Fuzztrek
¬_¬
DI_main.obj : error LNK2001: unresolved external symbol _IID_IDirectInput8A .\Debug/MainApp.exe : fatal error LNK1120: 1 unresolved externalsI understand the error, becuase I''ve had it before, and it was resolved by including dxguid.lib. Note that I include my libs with #pragma comment(lib, "filename.lib"). Not sure if that has anything to do with it. Here are my files: (main.cpp. Seems to be not understanding IID_IDirectInput8 in Init function)
#include "DI_cincludes.h"
// Constructor
DI_main::DI_main(){
pro_lpDI = NULL;
}
// Destructor
DI_main::~DI_main(){
//Free();
}
// Free
void DI_main::Free(){
RCOM(pro_lpDI);
pro_HWND = NULL;
pro_HINSTANCE = NULL;
}
// Create Direct Input
HRESULT DI_main::Init(HWND hwnd, HINSTANCE hinstance){
// Free everything
Free();
// Check for HWND
if(hwnd == NULL){
LogError("<li>DI Main: No HWND");
return E_FAIL;
}
// Check for HINSTANCE
if(hinstance == NULL){
LogError("<li>DI Main: No HINSTANCE");
return E_FAIL;
}
// Save HWND and HINSTANCE
pro_HWND = hwnd;
pro_HINSTANCE = hinstance;
// Create Direct Input
if(FAILED(DirectInput8Create(pro_HINSTANCE, DIRECTINPUT_VERSION, IID_IDirectInput8, (void **)&pro_lpDI, NULL))){
LogError("<li>DI Main: Failed creating DI");
return E_FAIL;
}
// Successful!
LogInfo("<li>DI Main: Created successfully");
return S_OK;
}
// Get HWND
HWND DI_main::GetHWND(){
return pro_HWND;
}
// Get HINSTANCE
HINSTANCE DI_main::GetHINSTANCE(){
return pro_HINSTANCE;
}
// Get DI
IDirectInput8 * DI_main::GetDI(){
return pro_lpDI;
}
#include "../Log.h" #include "DI_includes.h" #include "DI_main.h" #include "DI_device.h"
#include <stdlib.h> #include <stdio.h> #include <string.h> #pragma comment(lib, "dxguid.lib") #pragma comment(lib, "dinput8.lib") #define DIRECTINPUT_VERSION 0x0800 #include <DINPUT.h> class DI_main; class DI_device; typedef DI_main CDI; typedef DI_device CDevice;