nono1928
Messages postés5Date d'inscriptionjeudi 11 décembre 2003StatutMembreDernière intervention 9 avril 2008
-
6 avril 2008 à 14:57
nono1928
Messages postés5Date d'inscriptionjeudi 11 décembre 2003StatutMembreDernière intervention 9 avril 2008
-
9 avril 2008 à 00:15
Bonjour à tous, voilà ça fait plusieurs heures que je bloque
sur un pb, j'imagine que la réponse est simple mais comme je suis débutant...
J'essaie de faire fonctionner un programme minimaliste qui m'affiche
(simplement avec un printf) la positon de mon joystick. Je voudrais utiliser
DirectInput. J'ai trouvé plusieurs exemples de codes qui font ça, mais j'arrive à en
compiler aucun (je suis sous Dev-C++). En fait j'ai une erreur de linkage car les programmes utilisent
tous un #include <dinput.h> et moi
dans les librairies du SDK que je viens de télécharger, j’ai bien un dinput.h
mais pas de dinput.lib, seulement un dinput8.lib. Mais du coup je n’ai pas de
dinput8.h… Bref, comment je m’en sors ??
nono1928
Messages postés5Date d'inscriptionjeudi 11 décembre 2003StatutMembreDernière intervention 9 avril 2008 6 avril 2008 à 18:53
Non ça ne marche pas, peut-etre que je cherche du mauvais coté. Les erreurs qu'il me fait c'est
.drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" ' unrecognized
[Linker error] undefined reference to `IID_IDirectInput8A'
[Linker error] undefined reference to `DirectInput8Create@20'
(..)
[Linker error] undefined reference to `GUID_XAxis'
(...)
Vous n’avez pas trouvé la réponse que vous recherchez ?
f_l_a_s_h_b_a_c_k
Messages postés56Date d'inscriptionvendredi 14 avril 2006StatutMembreDernière intervention 1 février 2009 8 avril 2008 à 03:02
entre ceci au debut du code
#include <ddraw.h>
#pragma comment(lib, "ddraw.LIB")
et apres
#define DIRECTINPUT_VERSION 0x0700
//0x0700 ou sa 0x0800 ou 9 etc depand de quel version de dinput que tu utilise!
avec 0x0700 sa devrais faire l affaire!
nono1928
Messages postés5Date d'inscriptionjeudi 11 décembre 2003StatutMembreDernière intervention 9 avril 2008 8 avril 2008 à 20:16
Malheureusement ça ne fonctionne tjs pas.
Avec la version 7, j'ai ces erreurs:
Compilateur: Default compiler
Building Makefile: "C:\joystick\prog\01 dimanche\joystick-1.0\Makefile.win"
Exécution de make...
make.exe -f "C:\joystick\prog\01 dimanche\joystick-1.0\Makefile.win" all
g++.exe -c main3.cpp -o main3.o -I"C:/joystick/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/joystick/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/joystick/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/joystick/Dev-Cpp/include/c++/3.4.2" -I"C:/joystick/Dev-Cpp/include" -I"C:/joystick/Microsoft DirectX SDK (March 2008)/Lib/x86"
In file included from main3.cpp:17:
joystick.h:19: error: `LPDIRECTINPUT8' does not name a type
joystick.h:20: error: `LPDIRECTINPUTDEVICE8' does not name a type
In file included from main3.cpp:18:
joystick.cpp: In constructor `Joystick::Joystick(unsigned int)':
joystick.cpp:17: error: `di' undeclared (first use this function)
joystick.cpp:17: error: (Each undeclared identifier is reported only once for each function it appears in.)
joystick.cpp:18: error: `joystick' undeclared (first use this function)
joystick.cpp: In member function `long int Joystick::deviceName(char*)':
joystick.cpp:35: error: `di' undeclared (first use this function)
joystick.cpp:35: error: `joystick' undeclared (first use this function)
joystick.cpp: In member function `long int Joystick::open()':
joystick.cpp:54: error: `IID_IDirectInput8' undeclared (first use this function)
joystick.cpp:54: error: `di' undeclared (first use this function)
joystick.cpp:54: error: `DirectInput8Create' undeclared (first use this function)
joystick.cpp:62: error: `DI8DEVCLASS_GAMECTRL' undeclared (first use this function)
joystick.cpp:68: error: `joystick' undeclared (first use this function)
joystick.cpp: In member function `long int Joystick::close()':
joystick.cpp:93: error: `joystick' undeclared (first use this function)
joystick.cpp:98: error: `di' undeclared (first use this function)
joystick.cpp: In member function `long int Joystick::poll(DIJOYSTATE2*)':
joystick.cpp:108: error: `joystick' undeclared (first use this function)
joystick.cpp: In member function `BOOL Joystick::enumCallback(const DIDEVICEINSTANCE*, void*)':
joystick.cpp:153: error: `di' undeclared (first use this function)
joystick.cpp:153: error: `joystick' undeclared (first use this function)
joystick.cpp: In static member function `static unsigned int Joystick::deviceCount()':
joystick.cpp:179: error: `LPDIRECTINPUT8' undeclared (first use this function)
joystick.cpp:179: error: expected `;' before "di"
joystick.cpp:182: error: `IID_IDirectInput8' undeclared (first use this function)
joystick.cpp:182: error: `di' undeclared (first use this function)
joystick.cpp:182: error: `DirectInput8Create' undeclared (first use this function)
joystick.cpp:186: error: `DI8DEVCLASS_GAMECTRL' undeclared (first use this function)
make.exe: *** [main3.o] Error 1
Exécution terminée
-----------------------------------------------------------------------------
Avec la version 8 ou 9, j'ai ces erreurs:
Compilateur: Default compiler
Building Makefile: "C:\joystick\prog\01 dimanche\joystick-1.0\Makefile.win"
Exécution de make...
make.exe -f "C:\joystick\prog\01 dimanche\joystick-1.0\Makefile.win" all
g++.exe -c main3.cpp -o main3.o -I"C:/joystick/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/joystick/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/joystick/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/joystick/Dev-Cpp/include/c++/3.4.2" -I"C:/joystick/Dev-Cpp/include" -I"C:/joystick/Microsoft DirectX SDK (March 2008)/Lib/x86"
main3.o(.text+0x167):main3.cpp: undefined reference to `IID_IDirectInput8A'
main3.o(.text+0x177):main3.cpp: undefined reference to `DirectInput8Create@20'
main3.o(.text+0x201):main3.cpp: undefined reference to `c_dfDIJoystick2'
main3.o(.text+0x4d6):main3.cpp: undefined reference to `IID_IDirectInput8A'
main3.o(.text+0x4e6):main3.cpp: undefined reference to `DirectInput8Create@20'
collect2: ld returned 1 exit status
make.exe: *** [joystick2.exe] Error 1
Exécution terminée
---------------------------------------------------------
Je ne comprends pas...
Merci d'avance !
nono1928
Messages postés5Date d'inscriptionjeudi 11 décembre 2003StatutMembreDernière intervention 9 avril 2008 9 avril 2008 à 00:15
Non ça ne compile pas. Par contre, un truc que je comprends pas: j'ai une classe joystick et une classe test presque vide. La classe Joystick.cpp se compile normalement, si elle est toute seule. Dans la classe test, si j'appelle juste joystick.h ça compile, c'est normal. Par contre si je rajoute joystick.cpp, ou si je link avec joystick.a, là j'obtiens exactement les mêmes erreurs que précédement !! Pourtant je fais juste un #include "joystick.cpp". Une explication?