ClementDrn / Sudoku

Sudoku generator and solver
MIT License
2 stars 1 forks source link

SFML Bug: Cannot run with a Win32 build. #1

Open ClementDrn opened 2 years ago

ClementDrn commented 2 years ago

Description

An error occurs at the start of the application when running a Win32 build.

In JoystickImpl.cpp: image

How to reproduce

Just run the project with Visual Studio configured to Win32.

Requirements

In order to close the issue, the application should be able to run with Win32 without the error.

ClementDrn commented 2 years ago

It seems the issue is coming from the C++ function calling convention. The function pointer does not have the same calling convention as the program.

By default the function calling convention was set to __cdecl.

ClementDrn commented 2 years ago

I could not fix the issue with the other calling conventions but I found something concerning JoystickImpl.cpp in the build console.

1>------ Build started: Project: SFML, Configuration: Debug Win32 ------
1>JoystickImpl.cpp
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\dinput.h: DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800
1>JoystickImpl.obj : warning LNK4006: "public: static void __cdecl sf::priv::JoystickImpl::initialize(void)" (?initialize@JoystickImpl@priv@sf@@SAXXZ) already defined in JoystickImpl1.obj; second definition ignored
1>JoystickImpl.obj : warning LNK4006: "public: static void __cdecl sf::priv::JoystickImpl::cleanup(void)" (?cleanup@JoystickImpl@priv@sf@@SAXXZ) already defined in JoystickImpl1.obj; second definition ignored
1>JoystickImpl.obj : warning LNK4006: "public: static bool __cdecl sf::priv::JoystickImpl::isConnected(unsigned int)" (?isConnected@JoystickImpl@priv@sf@@SA_NI@Z) already defined in JoystickImpl1.obj; second definition ignored
1>JoystickImpl.obj : warning LNK4006: "public: bool __thiscall sf::priv::JoystickImpl::open(unsigned int)" (?open@JoystickImpl@priv@sf@@QAE_NI@Z) already defined in JoystickImpl1.obj; second definition ignored
1>JoystickImpl.obj : warning LNK4006: "public: void __thiscall sf::priv::JoystickImpl::close(void)" (?close@JoystickImpl@priv@sf@@QAEXXZ) already defined in JoystickImpl1.obj; second definition ignored
1>JoystickImpl.obj : warning LNK4006: "public: struct sf::priv::JoystickCaps __thiscall sf::priv::JoystickImpl::getCapabilities(void)const " (?getCapabilities@JoystickImpl@priv@sf@@QBE?AUJoystickCaps@23@XZ) already defined in JoystickImpl1.obj; second definition ignored
1>JoystickImpl.obj : warning LNK4006: "public: struct sf::Joystick::Identification __thiscall sf::priv::JoystickImpl::getIdentification(void)const " (?getIdentification@JoystickImpl@priv@sf@@QBE?AUIdentification@Joystick@3@XZ) already defined in JoystickImpl1.obj; second definition ignored
1>JoystickImpl.obj : warning LNK4006: "public: struct sf::priv::JoystickState __thiscall sf::priv::JoystickImpl::update(void)" (?update@JoystickImpl@priv@sf@@QAE?AUJoystickState@23@XZ) already defined in JoystickImpl1.obj; second definition ignored
1>SFML.vcxproj -> C:\Code\Visual Studio\Projects\Sudoku\Sudoku\vendor\SFML\bin\Debug-windows-x86\SFML\SFML.lib
1>Done building project "SFML.vcxproj".

Those warnings seem suspicious.

ClementDrn commented 2 years ago

I succeeded to remove the warnings. The implementation files for OpenBSD were also included in the project in addition to the Win32 files, so I removed them. Unfortunately, the error didn't disappear...