How do I include Steam_Api.h?

In my project, intellisense is finding the header just fine under “Steam/steam_api.h”, once included intellisense is also telling me I can access its members just fine ie. “SteamUserStats()” however when building all I get is “Error C1083 Cannot open include file: ‘Steam/steam_api.h’: No such file or directoy”

steam works just fine with the project, what i’m trying to do is use steams leaderboard functions. also before the “it works out of the box” guys jump in on this, no it doesn’t, there is currently no way to read global leaderboards with the in-engine stuff, that’s what i’m trying to get working.

For what its worth if it makes any difference i’m doing this in a child of AGameMode

I’m interested in more info on this as well.

i was unable to do this myself, to read the steam selected language for localization. What i ended up doing is to edit OnlineSubsystemSteam myself adding the function i needed. Honestly, i dont know why it doesnt have functions like GetSteamLanguage by itself.

ok so I found a solution to this thanks to “Mordentral” the author of the advanced sessions plugin.

in your build.cs file you need to add “Steamworks” and “OnlineSubsystemUtils” to either your public or private Dependency Module Names (depending on your project layout)

then in the files you want to use it in I use this:

this makes sure that the include only happens if your build platform is windows and it stops the compiler throwing out a bunch of ridiculous warnings for the steam library allegedly using deprecated standard C functions.

Hope this is useful :slight_smile:

3 Likes

As of 4.27 I was able to get it to build by putting this in the header.

THIRD_PARTY_INCLUDES_START

#include "steam/steam_api.h"

THIRD_PARTY_INCLUDES_END

Then in PROJECT_FOLDER/Source/PROJECT/PROJECT.Build.cs

add
“Steamworks” and “OnlineSubsystemUtils” to my public dependencies.

1 Like