Download

UE4 4.25.3 c++ SteamAPI_Init() Issue

Hi everyone,
I have an issue when I try to call SteamAPI_Init() to check the steamID:

unresolved external symbol __imp_SteamAPI_Init referenced in function “public: void __cdecl AHttpActor::GetSteamIDByString(void)” (?GetSteamIDByString@AHttpActor@@QEAAXXZ)

I think that I’ve added all the necessary stuff like:

ProjectName_Project.Build.cs
DynamicallyLoadedModuleNames.Add(“OnlineSubsystemSteam”);
PrivateDependencyModuleNames.AddRange(new string[] { “OnlineSubsystem”, “OnlineSubsystemUtils” });

ProjectName_Project.Target.cs
bUsesSteam = true;

and all in the DefaultEngine.ini seems correct.

I’ve followed that topic to try to solve but it doesn’t work: What's wrong with my steam settings?

Also, I’ve tried to follow the UE4 documentation and link the DLLs on my own but doesn’t work either.

I don’t know where to continue to watch to solve them.

thanks all!

SteamIssue_02|690x27
SteamIssue_01

My use of Steam with the UE4 codebase didn’t go smoothly. I do use Steam and had to take a few steps to get it to work. Maybe this will be of help:

.uproject
	"Plugins": [
		{
			"Name": "OnlineFramework",
			"Enabled": true
		},
		{
			"Name": "OnlineSubsystem",
			"Enabled": true
		},
		{
			"Name": "OnlineSubsystemSteam",
			"Enabled": true
		},

And in Target.cs:

		bUsesSteam = true;
		ProjectDefinitions.Add("ONLINE_SUBSYSTEM_EOS_ENABLE_STEAM=1");

And Build.cs:

		DynamicallyLoadedModuleNames.Add("OnlineSubsystemSteam");

Then in my SteamScores.h/cpp I have a pragma to force the inclusion of the Steam library:

.h
#include "ThirdParty/Steamworks/Steamv151/sdk/public/steam/steam_api.h"
#include "ThirdParty/Steamworks/Steamv151/sdk/public/steam/isteamuserstats.h"

#pragma comment(lib, "ThirdParty/Steamworks/Steamv151/sdk/redistributable_bin/win64/steam_api64.lib")

class SteamScores : public IScores
{
private:

	CGameID* pGameID;
	CSteamID localUserID;

public:

	SteamScores();

In the cpp:

SteamScores::SteamScores()
{
    pGameID = new CGameID(SteamUtils()->GetAppID());

    if (SteamUser()->BLoggedOn())
    {
        localUserID = SteamUser()->GetSteamID();
    }
    :
}

There are a few other items taking place in my Steam code to handle the callbacks, etc. that I am omitting. The UE4 Steam API didn’t work for me as advertised so I took another approach.

You may notice the EOS in Target.cs, which is for Epic Online Services, which I intended to switch to if it works. It may not be needed. The #pragma commit(lib, “”) may help your needs the most.

Adding #pragma fixes the error. Thanks so much!

1 Like