Sign in to follow this  

A 'little' problem with dinput..

This topic is 4343 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When i used Visual C++ 6.0 to build my project this code work.. So now i use Visual C++ Express and when i try to declare my class:
class diManager
{
public:
..............

private:
	diManager(void);

	LPDIRECTINPUT8        g_lpDI;			// the direct input object
	LPDIRECTINPUTDEVICE8  g_lpDIDeviceMouse;	// the direct input device
	LPDIRECTINPUTDEVICE8  g_lpDIDeviceKeyboard;	// the direct input device
...
};


When i try to compile it:

1>.\winmain.cpp(9) : warning C4005: 'DIRECTINPUT_VERSION' : macro redefinition
1>        C:\Programmi\Microsoft Visual Studio\VC98\Include\dinput.h(27) : see previous definition of 'DIRECTINPUT_VERSION'
1>.\winmain.cpp(375) : error C2146: syntax error : missing ';' before identifier 'g_lpDI'
1>.\winmain.cpp(375) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\winmain.cpp(375) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\winmain.cpp(376) : error C2146: syntax error : missing ';' before identifier 'g_lpDIDeviceMouse'
1>.\winmain.cpp(376) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\winmain.cpp(376) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\winmain.cpp(378) : error C2146: syntax error : missing ';' before identifier 'g_lpDIDeviceKeyboard'
1>.\winmain.cpp(378) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\winmain.cpp(378) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\winmain.cpp(390) : error C2065: 'g_lpDI' : undeclared identifier
1>.\winmain.cpp(391) : error C2065: 'g_lpDIDeviceMouse' : undeclared identifier
1>.\winmain.cpp(393) : error C2065: 'g_lpDIDeviceKeyboard' : undeclared identifier
1>.\winmain.cpp(411) : error C2065: 'IID_IDirectInput8' : undeclared identifier
1>.\winmain.cpp(410) : error C3861: 'DirectInput8Create': identifier not found
Anyone can help me? I don't know what i can to do to solve this problem.

Share this post


Link to post
Share on other sites
Have you got both the platform SDK and DirectX SDK installed and configured for your new compiler?

Note that if you already had those installed before upgrading your IDE/compiler that it may not know they exist (as such) and you'll need to configure your IDE properties.

Go to "Tools" -> "Options" -> "Projects and Solutions" -> "VC++ Directories". Check that the SDK's are listed in the "library" and "include" sections.

hth
Jack

Share this post


Link to post
Share on other sites
[edit] Meh, beat to it =) [/edit]

Hmm off-hand I'd think you are either not linking to the libraries, or linking to the incorrect ones.

Another thing to check for is that you are defining the version to use. For instance, if you are using DirectInput8, make sure to put this in your code.

#define DIRECTINPUT_VERSION 0x0800

Honestly, I can't even remember what that does but I know it was important =)

Share this post


Link to post
Share on other sites
I'm a stupid. I've included two type of dinput.h .. dinput of Summer Release and December Release. So now VC++ Express compile my program.. But now i have a error on linker.. Uff..

(Sorry for my bad english! =) )

1>Linking...
1>winmain.obj : error LNK2019: unresolved external symbol _memcpy_s referenced in function "public: static char * __cdecl std::char_traits<char>::_Copy_s(char *,unsigned int,char const *,unsigned int)" (?_Copy_s@?$char_traits@D@std@@SAPADPADIPBDI@Z)
1>winmain.obj : error LNK2019: unresolved external symbol _memmove_s referenced in function "public: static char * __cdecl std::char_traits<char>::_Move_s(char *,unsigned int,char const *,unsigned int)" (?_Move_s@?$char_traits@D@std@@SAPADPADIPBDI@Z)
1>winmain.obj : error LNK2019: unresolved external symbol "public: __thiscall std::exception::exception(char const * const &)" (??0exception@std@@QAE@ABQBD@Z) referenced in function "public: __thiscall std::bad_alloc::bad_alloc(char const *)" (??0bad_alloc@std@@QAE@PBD@Z)
1>winmain.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
1>winmain.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall std::exception::~exception(void)" (??1exception@std@@UAE@XZ) referenced in function "public: virtual __thiscall std::bad_alloc::~bad_alloc(void)" (??1bad_alloc@std@@UAE@XZ)
1>winmain.obj : error LNK2019: unresolved external symbol "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z) referenced in function "public: virtual __thiscall CModel::~CModel(void)" (??1CModel@@UAE@XZ)
1>winmain.obj : error LNK2019: unresolved external symbol ___security_cookie referenced in function "public: void __thiscall bn_Font::Initialise(struct IDirect3DDevice9 *,struct bn_FontInformations)" (?Initialise@bn_Font@@QAEXPAUIDirect3DDevice9@@Ubn_FontInformations@@@Z)
1>winmain.obj : error LNK2019: unresolved external symbol @__security_check_cookie@4 referenced in function "public: void __thiscall bn_Font::Initialise(struct IDirect3DDevice9 *,struct bn_FontInformations)" (?Initialise@bn_Font@@QAEXPAUIDirect3DDevice9@@Ubn_FontInformations@@@Z)
1>winmain.obj : error LNK2019: unresolved external symbol __invalid_parameter_noinfo referenced in function "public: class CGameObject * & __thiscall std::vector<class CGameObject *,class std::allocator<class CGameObject *> >::operator[](unsigned int)" (??A?$vector@PAVCGameObject@@V?$allocator@PAVCGameObject@@@std@@@std@@QAEAAPAVCGameObject@@I@Z)
1>winmain.obj : error LNK2001: unresolved external symbol "public: __thiscall std::exception::exception(class std::exception const &)" (??0exception@std@@QAE@ABV01@@Z)
1>winmain.obj : error LNK2019: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::erase(unsigned int,unsigned int)" (?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@II@Z)
1>winmain.obj : error LNK2019: unresolved external symbol ___CxxFrameHandler3 referenced in function __ehhandler$?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAEXII@Z
1>winmain.obj : error LNK2019: unresolved external symbol "public: static void __cdecl std::_String_base::_Xlen(void)" (?_Xlen@_String_base@std@@SAXXZ) referenced in function "protected: bool __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Grow(unsigned int,bool)" (?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAE_NI_N@Z)
1>winmain.obj : error LNK2019: unresolved external symbol "void * __cdecl operator new[](unsigned int)" (??_U@YAPAXI@Z) referenced in function "public: bool __thiscall CModel::loadModel(struct IDirect3DDevice9 *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?loadModel@CModel@@QAE_NPAUIDirect3DDevice9@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>winmain.obj : error LNK2019: unresolved external symbol "public: __thiscall std::exception::exception(void)" (??0exception@std@@QAE@XZ) referenced in function "public: __thiscall std::logic_error::logic_error(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0logic_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z)
1>winmain.obj : error LNK2019: unresolved external symbol "public: int __thiscall GestioneTurni::AssegnaTurnoSquadra1(int)" (?AssegnaTurnoSquadra1@GestioneTurni@@QAEHH@Z) referenced in function "public: bool __thiscall Game::init(struct HWND__ *,struct D3DXVECTOR3)" (?init@Game@@QAE_NPAUHWND__@@UD3DXVECTOR3@@@Z)
1>C:\Documents and Settings\Tano\Documenti\Visual Studio 2005\Projects\videologie0.1\directx\videologie0.1.exe : fatal error LNK1120: 16 unresolved externals

Share this post


Link to post
Share on other sites

This topic is 4343 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this