Archived

This topic is now archived and is closed to further replies.

origil

The never ending war, direct input vs borland 5...

Recommended Posts

origil    134
Here''s the problem. I compiled the DirectInputCreateEx function and the compiler generates an error: "Error: Error processing module" or "Unresolved external DirectInputCreateEx" It might generate any of the 2. If I take the DirectInputEx function out of the program, the code remains error-free. I''ve seen this was a problem common to borland 5 compilers. A few ppl asked about this on the boards but received no helping answers. If anyone knows how to fix this and is willing to help me I''d really appreciate it.

Share this post


Link to post
Share on other sites
origil    134
Yes, I include it using:
#pragma comment( lib, "dinput.lib" )

and when I take the line off it generates an error it does not recoginze the _c_dfDIKeyboard, so I''m pretty sure it''s included

Share this post


Link to post
Share on other sites
Dactylos    122
Are you linking to the correct version of dinput.lib? i.e. not the old version that comes with MSVC++, check the order of your lib-directories in the options.

[EDIT]
Sorry, just realised that you wrote you were using the Borland compiler.
I don't know if Borland comes with any version of DirectX, but still, is the correct version being linked?
Can't think of anything else right now...
[/EDIT]

Edited by - Dactylos on October 18, 2001 5:18:27 PM

Share this post


Link to post
Share on other sites
Sly    128
The Borland compatible libraries can be found here. Are you using these Borland-compatible libs or the ones provided with the DirectX SDK? I do not use DirectX with C++ Builder because I prefer using Delphi, so other than providing the link I''m not much help.

One of the best things about Delphi... no libs to link with.

Steve ''Sly'' Williams  Monkey Wrangler  Krome Studios

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Thanks for the replies
I''ll be sure to check the lib.

Share this post


Link to post
Share on other sites
origil    134
Thanks a lot for the help,
the only problem now is that the compiler generates this new and cute error: Unresolved external _c_dfDIKeyBoard referenced from...
What I am doing wrong this time?

Share this post


Link to post
Share on other sites
Jappie    122
Be sure to add dxguid.lib to your project. That''s where all the _c_dfDI* stuff is in.

-----------------------------
Jappie
BabJap Productions

"There''s no such things as bugs; they''re just unintentional extra features"

Share this post


Link to post
Share on other sites
Jappie    122
Hmm... long shot here: I assume you''re using Michael Foetsch''s libs now. Try to include c_dinput.lib as well as the others. If that doesn''t solve it, try writing c_dfDIKeyboard without a capital B...

-----------------------------
Jappie
BabJap Productions

"There''s no such things as bugs; they''re just unintentional extra features"

Share this post


Link to post
Share on other sites
origil    134
Thanks a lot!
It worked!
I included the c_input.lib.
But of course as with DirectX, another error decided to pop out...
When I use the function

DirectInputCreateEx(main_instance_handle, DIRECTINPUT_VERSION, IID_IDirectInputDevice7, (void**)&lpdi, NULL)

and run the program, the function returns an error and the program bails out.

Share this post


Link to post
Share on other sites
Jappie    122
Right, I''m running out of ideas here I think it has something to do with exclusive/non-exclusive mode, so I''ll just post a snippet here that works fine for me. Add all the libs you have so far, and you _should_ be off...

  
// Main DirectInput device

hr = ( DirectInput8Create( hInstance, DIRECTINPUT_VERSION,
IID_IDirectInput8, ( void ** )&lpdi, NULL ) );
if( FAILED( hr ) )
return false;

// Keyboard

hr = ( lpdi->CreateDevice( GUID_SysKeyboard, &lpdi_keyboard,
NULL ) );
if( FAILED( hr ) )
return false;

hr = ( lpdi_keyboard->SetDataFormat( &c_dfDIKeyboard ) );
if( FAILED( hr ) )
return false;

hr = ( lpdi_keyboard->SetCooperativeLevel( hWnd,
DISCL_FOREGROUND | DISCL_NONEXCLUSIVE ) );
if( FAILED( hr ) )
return false;

hr = ( lpdi_keyboard->Acquire() );
if( FAILED( hr ) )
return false;


-----------------------------
Jappie
BabJap Productions

"There''s no such things as bugs; they''re just unintentional extra features"

Share this post


Link to post
Share on other sites
origil    134
Thanks for all of the replies, you all helped a lot.
I guess I''ll be using Direct Input 1, since 7 didn''t work and I don''t want to download the DX8 sdk.

Share this post


Link to post
Share on other sites