How can I get Visual Studio 2017 to compile UE4.19 and Steamworks 1.39?

Hi all,

I am struggling to get Visual Studio 2017 to successfully compile a newly created Blueprint Function Library.

As soon as I add the include to the steam api header file and try to compile it moans about ARRAY_COUNT macro redefinition, strncpy warnings and various other syntax errors in the gen.cpp.

I have searched around various tutorials (Unreal Docs, Rama, Epic Wiki etc) and done the following:

  1. Used the Unreal Docs to add the relevant sections to the DefaultEngine.ini to configure the OnlineSystemSteam.
  2. Enabled the OnlineSubsystemSteam plugin in the game project.
  3. Added bUsesSteam=true; to the target.cs
  4. Uncommented the PrivateDependencyModuleNames.Add(“OnlineSubsystem”); in the build.cs
  5. Added PublicDependencyModuleNames.AddRange(new string[] { “OnlineSubsystem”, “OnlineSubsystemUtils” }); to the build.cs
  6. Added DynamicallyLoadedModuleNames.Add(“OnlineSubsystemSteam”); to the build.cs

My versions are:
Unreal Engine 4.19
Steamworks 1.39 (Came preinstalled with UE4.19)
Visual Studio 2017 (Vanilla version)

I know how to program code and blueprints but am somewhat new to C++ so I do not understand what the ARRAY_COUNT macro is/does. I’m usually able to diagnose problems like this but this one has me confused.

The most confusing thing for me is that the information on the net is relevant to several different versions of Unreal and some say to do this and some say to do that. I was hoping that enabling the OnlineSubsystemSteam plugin would have enabled me to do everything that the Steamworks SDK allows using Blueprints but that is not the case.

Any help on this would be appreciated.

Thanks in advance.

When I reached out to Unreal about this issue they responded with Valves response which is this macro around the includes of steamwork files in the header.

#pragma push_macro("ARRAY_COUNT")

#undef ARRAY_COUNT

THIRD_PARTY_INCLUDES_START

#include "ThirdParty/Steamworks/Steamv139/sdk/public/steam/steam_api.h"
#include "ThirdParty/Steamworks/Steamv139/sdk/public/steam/isteamuser.h"

THIRD_PARTY_INCLUDES_END

#pragma pop_macro("ARRAY_COUNT")

Hope this helps!