KoKuToru / koku-xinput-wine

Adds xinput support to wine, without changing the source of wine.
BSD 2-Clause "Simplified" License
69 stars 21 forks source link

‘XInputGetStateEx’ was not declared in this scope #28

Closed NicolasGoeddel closed 6 years ago

NicolasGoeddel commented 6 years ago

Hi,

I tried to compile the 64 bit version of your library but ran into this problem after installing libwine-dev libsdl2-dev cmake and build-essential using apt-get on an Ubuntu 17.04:

user@calculator:~/Downloads/koku-xinput-wine-1.2.1$ cmake -DBUILD_M32=OFF .
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'sdl2'
--   Found sdl2, version 2.0.5
-- Found wine headers: /usr/include/wine/windows
CMake Warning at CMakeLists.txt:84 (message):
  No 32-bit cross-compiler; skipping 32-bit tests

CMake Warning at CMakeLists.txt:97 (message):
  No 64-bit cross-compiler; skipping 64-bit tests

-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_M32

-- Build files have been written to: /home/user/Downloads/koku-xinput-wine-1.2.1
user@calculator:~/Downloads/koku-xinput-wine-1.2.1$ make
[ 12%] Building CXX object CMakeFiles/koku-xinput-wine64.dir/xinput.cpp.o
/home/user/Downloads/koku-xinput-wine-1.2.1/xinput.cpp:319:23: error: ‘XInputGetStateEx’ was not declared in this scope
 koku::jumper<decltype(XInputGetStateEx)> XInputGetStateExJumper;
                   ^~~~~~~~~~~~~~~~
/home/user/Downloads/koku-xinput-wine-1.2.1/xinput.cpp:319:23: error: ‘XInputGetStateEx’ was not declared in this scope
/home/user/Downloads/koku-xinput-wine-1.2.1/xinput.cpp:319:40: error: template argument 1 is invalid
 koku::jumper<decltype(XInputGetStateEx)> XInputGetStateExJumper;
                                    ^
/home/user/Downloads/koku-xinput-wine-1.2.1/xinput.cpp:320:50: error: ‘XINPUT_STATE_EX’ has not been declared
 DWORD WINAPI XInputGetStateEx(DWORD dwUserIndex, XINPUT_STATE_EX *pState) {
                                              ^~~~~~~~~~~~~~~
/home/user/Downloads/koku-xinput-wine-1.2.1/xinput.cpp: In function ‘void koku::XInputInit(void*)’:
/home/user/Downloads/koku-xinput-wine-1.2.1/xinput.cpp:382:59: error: cannot convert ‘koku::jumper<unsigned int(unsigned int, int*)>’ to ‘int’ in assignment
     koku::make_jumper(address, &koku::XInputGetStateEx);
                                                       ^
CMakeFiles/koku-xinput-wine64.dir/build.make:86: die Regel für Ziel „CMakeFiles/koku-xinput-wine64.dir/xinput.cpp.o“ scheiterte
make[2]: *** [CMakeFiles/koku-xinput-wine64.dir/xinput.cpp.o] Fehler 1
CMakeFiles/Makefile2:67: die Regel für Ziel „CMakeFiles/koku-xinput-wine64.dir/all“ scheiterte
make[1]: *** [CMakeFiles/koku-xinput-wine64.dir/all] Fehler 2
Makefile:83: die Regel für Ziel „all“ scheiterte
make: *** [all] Fehler 2

Any idea what I am missing?

NicolasGoeddel commented 6 years ago

I removed all parts which contain XINPUT_STATE_EX and XInputGetStateEx in your code because it seems these things are no more included in xinput.h

After also installing gcc-multilib and g++-multilib I was finally able to compile but now the linker does not find -lSDL2. How can that be?

user@calculator:~/Downloads/koku-xinput-wine-1.2.1$ make
[ 50%] Built target koku-xinput-wine64
[ 62%] Building CXX object CMakeFiles/koku-xinput-wine.dir/main.cpp.o
[ 75%] Building CXX object CMakeFiles/koku-xinput-wine.dir/xinput.cpp.o
[ 87%] Building CXX object CMakeFiles/koku-xinput-wine.dir/device.cpp.o
[100%] Linking CXX shared library koku-xinput-wine.so
/usr/bin/ld: cannot find -lSDL2
collect2: error: ld returned 1 exit status
CMakeFiles/koku-xinput-wine.dir/build.make:146: die Regel für Ziel „koku-xinput-wine.so“ scheiterte
make[2]: *** [koku-xinput-wine.so] Fehler 1
CMakeFiles/Makefile2:104: die Regel für Ziel „CMakeFiles/koku-xinput-wine.dir/all“ scheiterte
make[1]: *** [CMakeFiles/koku-xinput-wine.dir/all] Fehler 2
Makefile:83: die Regel für Ziel „all“ scheiterte
make: *** [all] Fehler 2
NicolasGoeddel commented 6 years ago

After apt-get purge libsdl2-dev and apt-get autoremove I finally was able to apt-get install libsdl2-dev:i386 with its dependencies without problems and the compilation of the 32 bit library was also successful. Now the library works without problems. I still don't know what's the issue with XINPUT_STATE_EX and XInputGetStateEx.