Skip to main content
gamedev.net
🔒 Locked

Problems with joystick - reference errors from compiler

Started by Tompa Nov 25, 2003 at 8:32 AM 9 replies 3k views
Original Post
Tompa
Tompa
Does anyone know what could be at fault when my compiler blurts this out: C:\DOCUME~1\KETOHA\LOKALA~1\Temp/ccq2baaa.o(.text+0xe4ff):JoyStick.cpp: undefine d reference to `IID_IDirectInput8A'' C:\DOCUME~1\KETOHA\LOKALA~1\Temp/ccq2baaa.o(.text+0xe511):JoyStick.cpp: undefine d reference to `DirectInput8Create@20'' C:\DOCUME~1\KETOHA\LOKALA~1\Temp/ccq2baaa.o(.text+0xe5ab):JoyStick.cpp: undefine d reference to `c_dfDIJoystick2'' Could it be that I havent got a new directX installed? I''m following msdn:s tutorial on joysticks. Thanks!
Dave Hunt
Dave Hunt
Did you link to dxguid and dinput8 libraries?
J_Vitel
J_Vitel
Are you linking to the DirectX 8 libs? (dinput8.lib and dxguid.lib)
also did you install the Directx8 SDK? and finally, check you included the proper libraries

in my page a have an example of using DInput8 if it''s of any help
DirectX 8 examples
My site Jvitel.com
Tompa
Tompa
Ok, I did not link to those libraries...
When I did, alot of other undefined references came up. Still the only one of the three messages (the last one) disappeared.

c:/Tompa/MinGW/bin/../lib/gcc-lib/mingw32/3.2.3/../../..\dinput8.lib(obj/i386/di
lib4.obj.b)(.text+0x0):..\dilib4.c: undefined reference to GUID_XAxis''
c:/Tompa/MinGW/bin/../lib/gcc-lib/mingw32/3.2.3/../../..\dinput8.lib(obj/i386/di
lib4.obj.b)(.text+0x10):..\dilib4.c: undefined reference to
GUID_YAxis''

...blablabla several lines in the same manner.

Since the path to theese messages is deep in my compiler libraries i think i might not have properly installed all the right files in the right places...
I use MinGW if you know it (with g++). Is it possible to install the microsoft SDK in my MinGW directories?
Dave Hunt
Dave Hunt
Try putting dxguid.lib after dinput8.lib on the command line.
Tompa
Tompa
Thanks!
Most of the faults disappeared with that little change.

Still, the first two are there...

C:\DOCUME~\KETOHA\LOKALA~\Temp/ccq2baaa.o.text+0xe4ff):JoyStick.cpp: undefined reference to IID_IDirectInput8A'
C:\DOCUME~1KETOHA\LOKALA~1Temp/ccq2baaa.o.text+0xe511):JoyStick.cpp: undefined reference to
DirectInput8Create@20'

But I saw another thing i missed before... this:

Warning: .drectve `%.*s' unrecognized


EDIT: This is what's in my compiler file:
path=c:\Tompa\MinGW\bin
g++ -o JoyStick JoyStick.cpp -lglut32 -lglu32 -lopengl32 -luser32 -lgdi32 -lglaux -ldinput8 -ldxguid



Hmm... What to do?



[edited by - Tompa on November 26, 2003 2:35:37 AM]

[edited by - Tompa on November 26, 2003 3:10:13 AM]
Tompa
Tompa
Managed to fix one of the problems now.
Needed to #define INITGUID (done before any directx included header files)

Just one reference error to go then... and one warning...

Warning: .drectve %.*s'' unrecognized
C:\DOCUME~1\KETOHA\LOKALA~1\Temp/cciiaaaa.o(.text+0xe831):JoyStick.cpp: undefine
d reference to
DirectInput8Create@20''

I tried to link to dinput instead of dinput8 and the warning about .drectve disappeared, but this will probably not solve anything since i think it''s the dinput8 that''s supposed to linked, right?
Tompa
Tompa
Hmm... I narrowed it down a bit. The problem still persist but I am quite sure that my compiler doesn''t find dinput8.lib, even if I copied it to the compiler lib-directory.
I posted a question at general programming on this matter. How do I add a new path for include and lib files from the dxsdk-directory so my compiler which is MinGW:s g++ ?
Dave Hunt
Dave Hunt
use -L yourlibdirpath before the -l options.

You can have multiple -L specs if you want to search multiple additional lib directories.
pjcast
pjcast
One thing sou should check for is that (if your using MSVS ) in tools->Options->Directory->Includes that the DXSDK\Includes Directory is at the top of the list. And also, in that same menu, check that in the libary files has DXSDK\Lib listed first. The exact path to the directories may be different on your machine, but just locate your directory for those and enter those. This will ensure that no older versions of directx headers (ones that came with the compiler) are read in .

Just my 2 cenets tho

Opps- Just realised you are not using vc - nevermind
[edited by - pjcast on November 26, 2003 11:00:08 AM]

[edited by - pjcast on November 26, 2003 11:12:25 AM]
Tompa
Tompa
About to give up on directinput8...
I searched about this problem all day long now and it seems like there is a problem with g++ working dinput8.lib or rather working with the format specified from MS (msvc format I keep reading). The lib-files should be named libdinput8.lib to work I think. I am not sure if msvc format is just the format of the name of the lib or the format of the lib itself. Probably the latter.
Do you know if I''m out in the blue here or do you know for certain that it does work, dinput8 plus g++, I mean?
Thanks again!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.