Skip to content

Commit

Permalink
Fixed bug 4918 - SDL failed to build due to error LNK2019: unresolved…
Browse files Browse the repository at this point in the history
… external symbol memset referenced in function SDL_SetJoystickIDForPlayerIndex with MSVC x64 on Windows

LinGao

We build SDL with Visual studio 2017 compiler on Windows Server 2016, but it failed to build due to error LNK2019: unresolved external symbol memset referenced in function SDL_SetJoystickIDForPlayerIndex with MSVC x64 on Windows on latest default branch. And we found that it can be first reproduced on 0fff06175109 changeset. Could you please help have a look about this issue? Thanks in advance!

Steps to Reproduce:
1.hg clone https://hg.libsdl.org/SDL D:\SDL\src
2.Open a VS 2017 x64 command prompt as admin and browse to D:\SDL
3.msbuild /p:Configuration=Release /p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0.17134.0 VisualC\SDL.sln /t:Rebuild

Actual result:
 Creating library D:\SDL\src\VisualC\x64\Release\SDL2.lib and object D:\SDL\src\VisualC\x64\Release\SDL2.exp
SDL_joystick.obj : error LNK2019: unresolved external symbol memset referenced in function SDL_SetJoystickIDForPlayerIndex [D:\SDL\src\VisualC\SDL\SDL.vcxproj]
D:\SDL\src\VisualC\x64\Release\SDL2.dll : fatal error LNK1120: 1 unresolved externals [D:\SDL\src\VisualC\SDL\SDL.vcxproj]
Done Building Project "D:\SDL\src\VisualC\SDL\SDL.vcxproj" (Rebuild target(s)) -- FAILED.
  • Loading branch information
slouken committed Dec 30, 2019
1 parent 98ce0e5 commit 8b0660b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/joystick/SDL_joystick.c
Expand Up @@ -158,9 +158,8 @@ SDL_SetJoystickIDForPlayerIndex(int player_index, SDL_JoystickID instance_id)
}

SDL_joystick_players = new_players;
while (SDL_joystick_player_count <= player_index) {
SDL_joystick_players[SDL_joystick_player_count++] = -1;
}
SDL_memset(&SDL_joystick_players[SDL_joystick_player_count], 0xFF, (player_index - SDL_joystick_player_count + 1) * sizeof(SDL_joystick_players[0]));
SDL_joystick_player_count = player_index + 1;
}

SDL_joystick_players[player_index] = instance_id;
Expand Down

0 comments on commit 8b0660b

Please sign in to comment.