Skip to main content
gamedev.net
🔒 Locked

DXSDK samples

Started by sherbear04 May 3, 2004 at 12:48 PM 15 replies 3.6k views
Original Post
sherbear04
sherbear04
Hi, I'm very new to DirectX and I'm trying use DirectInput..so when I try to run the sample code (joystick.cpp) I get: C:\DXSDK\samples\Multimedia\DirectInput\JoyStick\joystick.cpp(44) : error C2146: syntax error : missing ';' before identifier 'g_pDI' C:\DXSDK\samples\Multimedia\DirectInput\JoyStick\joystick.cpp(44) : error C2501: 'LPDIRECTINPUT8' : missing storage-class or type specifiers C:\DXSDK\samples\Multimedia\DirectInput\JoyStick\joystick.cpp(44) : fatal error C1004: unexpected end of file found Error executing cl.exe. can anybody tell me what I'm doing wrong?? Thanx, Sher [edited by - sherbear04 on May 3, 2004 1:56:29 PM]
parky1
parky1
do you link to d3d8.lib in your project settings?
sherbear04
sherbear04
I did not have d3d8.lib linked, but I just tried it and there was no change =(
Thank you very much for the suggestion!!
parky1
parky1
Hmm, not too sure then - as a quick fix to get you going until someone else can suggest the real solution, try #include "dinput.h"
?
VolkerG
VolkerG
Did you check the order of include directories (sdk directory should be one of the first).
sherbear04
sherbear04
including dinput.h didn''t work =(

how do I check the order of include directories??? (insert embarrassed smiley...)

thanx for helping!!
parky1
parky1
In Visual Studio 6 - Tools->Options->Directories

You need to have the direct x "include files" directory as well as the "library files" directory.

For example, under include files:
C:\PROGRAM FILES\DXSDK\INCLUDE

LIBRARY FILES:
C:\PROGRAM FILES\DXSDK\LIB

sherbear04
sherbear04
ok, so I took care of the include and lib directories...but now I have:
Linking...
joystick.obj : error LNK2001: unresolved external symbol _c_dfDIJoystick2
joystick.obj : error LNK2001: unresolved external symbol _DirectInput8Create@20
joystick.obj : error LNK2001: unresolved external symbol _IID_IDirectInput8A
joystick.obj : error LNK2001: unresolved external symbol _GUID_POV
joystick.obj : error LNK2001: unresolved external symbol _GUID_Slider
joystick.obj : error LNK2001: unresolved external symbol _GUID_RzAxis
joystick.obj : error LNK2001: unresolved external symbol _GUID_RyAxis
joystick.obj : error LNK2001: unresolved external symbol _GUID_RxAxis
joystick.obj : error LNK2001: unresolved external symbol _GUID_ZAxis
joystick.obj : error LNK2001: unresolved external symbol _GUID_YAxis
joystick.obj : error LNK2001: unresolved external symbol _GUID_XAxis
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/joystick.exe : fatal error LNK1120: 12 unresolved externals
Error executing link.exe.

Any thoughts?
sherbear04
sherbear04
Linking...
joystick.obj : error LNK2001: unresolved external symbol _DirectInput8Create@20
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/joystick.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

YAY! that got it down to only 3 errors =) is there something else that I also need to link???
CodeMunkie
CodeMunkie
DirectInput8Create is in dinput8.lib, so you need to link to that as well. The unresolved main is most likely because you created a Win32 Console Application which looks for main as the program entry point, but you likely used WinMain instead of main. You probably want to use WinMain, but you need to create a Win32 Application, not a Win32 Console Application.

[edited by - CodeMunkie on May 3, 2004 4:02:58 PM]
"When you die, if you get a choice between going to regular heaven or pie heaven, choose pie heaven. It might be a trick, but if it's not, mmmmmmm, boy."
How to Ask Questions the Smart Way.
VolkerG
VolkerG
Change the project type from a console to a Win32 application.
sherbear04
sherbear04
hehe um, how do I do that? =)
Pipo DeClown
Pipo DeClown
Create a new project -> Pick ''Win32 Application'' instead of ''Win32 Console Application'' -> Done.

You could also use:
#define INITGUID
#include <initguid.h>
But it''s not always needed.


--
You''re Welcome,
Rick Wong

- sitting in his chair doing the most time-consuming thing..
sherbear04
sherbear04
ok, so combining all your great advice I got the code to compile...but for some reason when I try to execute no window pops up =( why?!?!?!?!?!

Topic Locked

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

Sign in to reply to this topic.