Error while using steam_api.h on Linux/OSX

Hey,

Whenever i try to include the steam_api.h on Linux(or OSX) i get this error that:

ARRAY_COUNT is already defined in UnrealTemplate.h

Any workaround or fix for this issue?I Need to use the steam_api header file to use SteamTypes.

Thanks!

Yes i do, do you think removing it would fix the issue?

(ATM i have no Linux installation on my PC)

Here’s a workaround :
NOTE : you will need the full engine source code

1 - go into \Engine\Source\Programs\UnrealBuildTool and then Linux/LinuxToolChain.cs

in line 303 remove the flag -Werror (this will not treat warnings as errors)

2 - for OSX go into the Mac folder and then MacToolChain.cs

line 123 do the same thing (remove -Werror flag)

now instead of an error i get a warning which should at least make the code compile
warning:

steamtypes.h(98,9): warning : 'ARRAY_COUNT' macro redefined [-Wmacro-redefined]
3>  #define ARRAY_COUNT(COUNTER) CLANG_ATTR( "array_count:" #COUNTER ";" )
3>          ^
3>  Runtime/Core/Public/Templates\UnrealTemplate.h(98,9) :  note: previous definition is here
3>  #define ARRAY_COUNT( array ) (sizeof(ArrayCountHelper(array))+0)

Thanks a lot for sharing this. Not sure how many hours I would have spent tracking this down, you’ve really saved me some time :slight_smile: