Following Steam’s instructions at Step by Step: Leaderboards (Steamworks Documentation) I implemented a leaderboard in my game on PC and it works. Now I am trying to edit my game on a Mac but the editor fails with errors in the logs.
Leaderboard.cpp:
void CSteamLeaderboards::FindLeaderboard( const char *pchLeaderboardName ) {
m_CurrentLeaderboard = NULL;
SteamAPICall_t hSteamAPICall = SteamUserStats()->FindLeaderboard(pchLeaderboardName);
m_callResultFindLeaderboard.Set(hSteamAPICall, this, &CSteamLeaderboards::OnFindLeaderboard);
}
Errors:
/Users/.../UE_4.21/Engine/Source/ThirdParty/Steamworks/Steamv139/sdk/public/steam/steamtypes.h:99:9: error: 'ARRAY_COUNT' macro redefined [-Werror,-Wmacro-redefined]
#define ARRAY_COUNT(COUNTER) CLANG_ATTR( "array_count:" #COUNTER ";" )
^
/Users/.../UE_4.21/Engine/Source/Runtime/Core/Public/Templates/UnrealTemplate.h:153:9: note: previous definition is here
#define ARRAY_COUNT( array ) (sizeof(ArrayCountHelper(array)) - 1)
^
In file included from /Users/.../UE_4.21/Engine/Source/ThirdParty/Steamworks/Steamv139/sdk/public/steam/isteamuserstats.h:13:
In file included from /Users/.../UE_4.21/Engine/Source/ThirdParty/Steamworks/Steamv139/sdk/public/steam/isteamclient.h:14:
/Users/.../UE_4.21/Engine/Source/ThirdParty/Steamworks/Steamv139/sdk/public/steam/steamtypes.h:99:9: error: 'ARRAY_COUNT' macro redefined [-Werror,-Wmacro-redefined]
#define ARRAY_COUNT(COUNTER) CLANG_ATTR( "array_count:" #COUNTER ";" )
^
/Users/.../UE_4.21/Engine/Source/Runtime/Core/Public/Templates/UnrealTemplate.h:153:9: note: previous definition is here
#define ARRAY_COUNT( array ) (sizeof(ArrayCountHelper(array)) - 1)
^
/Users/.../Leaderboard.cpp:6:25: error: implicit conversion of NULL constant to 'SteamLeaderboard_t' (aka 'unsigned long long') [-Werror,-Wnull-conversion]
m_CurrentLeaderboard = NULL;
~ ^~~~
0
There are no errors when opening this game in the editor on PC, but on a Mac the editor throws these errors and fails to open the game. Xcode version 10.1, OS Mojave 10.14.2