x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

LNK2001 unresolved external symbol, Steamworks

I'm having troubles with getting Steamworks integration to work. I have tried resources and questions from either here or StackOverflow and haven't been able to figure it out. Any help or guidance will be useful, thank you.

 Severity    Code    Description    Project    File    Line    Suppression State
 Error    LNK2001    unresolved external symbol "public: void __cdecl CSteamID::SetFromString(char const *,enum EUniverse)" (?SetFromString@CSteamID@@QEAAXPEBDW4EUniverse@@@Z)    lsr    C:\Users\Evan\Documents\Unreal Projects\lsr\Intermediate\ProjectFiles\BlueprintSteamAPI.gen.cpp.obj    1    

BlueprintSteamAPI.h

 #pragma once
 
 #pragma push_macro("ARRAY_COUNT")
 #include "CoreMinimal.h"
 #include "Kismet/BlueprintFunctionLibrary.h"
 
 #undef ARRAY_COUNT
 
 THIRD_PARTY_INCLUDES_START
 #include "ThirdParty/steamworks/Steamv139/sdk/public/steam/steam_api.h"
 #include "ThirdParty/steamworks/Steamv139/sdk/public/steam/isteamfriends.h"
 THIRD_PARTY_INCLUDES_END
 
 #pragma pop_macro("ARRAY_COUNT")
 #include "BlueprintSteamAPI.generated.h"
 
 /**
  * 
  */
 UCLASS()
 class LSR_API UBlueprintSteamAPI : public UBlueprintFunctionLibrary
 {
     GENERATED_BODY()
     UFUNCTION(BlueprintCallable, Category = "Steam")
     static void SendSteamMessage(FString SteamID64, FString type) {
         char* typeresult = TCHAR_TO_ANSI(*type);
         char* SteamID642 = TCHAR_TO_ANSI(*SteamID64);
         RawSteamMessage(SteamID642, typeresult);
     }
         
     static CSteamID steamIDGet(char*  SteamID64) {
         CSteamID cID;
         cID.SetFromString(SteamID64, k_EUniversePublic);
         return cID;
     }
 
     static void RawSteamMessage(char*  SteamID64, char* type) {
 
         if (SteamAPI_Init()) {
             CSteamID id = steamIDGet(SteamID64);
             
             SteamFriends()->ActivateGameOverlayToUser(type, id);
             
         
         };
 
     }
 };

lsr.Build.cs

 using UnrealBuildTool;
 
 public class lsr : ModuleRules
 {
     public lsr(ReadOnlyTargetRules Target) : base(Target)
     {
         PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
     
         PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore","OnlineSubsystemUtils","OnlineSubsystem","Steamworks"});
         PrivateDependencyModuleNames.AddRange(new string[] { "Steamworks" });
 
         DynamicallyLoadedModuleNames.Add("OnlineSubsystemSteam");
     }
 }

lsr.Target.cs

 using UnrealBuildTool;
 using System.Collections.Generic;
 
 public class lsrTarget : TargetRules
 {
     public lsrTarget(TargetInfo Target) : base(Target)
     {
         Type = TargetType.Game;
         bUsesSteam = true;
         ExtraModuleNames.AddRange( new string[] { "lsr" } );
     }
 }
Product Version: UE 4.21
Tags:
more ▼

asked Dec 12 '18 at 11:05 PM in C++ Programming

avatar image

Theopathy
1 1 1

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

You seem to add Steamworks decency in wrong way, if you look on how OnlineSubsystemSteam does it:

https://github.com/EpicGames/UnrealEngine/blob/b70f31f6645d764bcb55829228918a6e3b571e0b/Engine/Plugins/Online/OnlineSubsystemSteam/Source/OnlineSubsystemSteam.Build.cs

It should be like this:

 AddEngineThirdPartyPrivateStaticDependencies(Target, "Steamworks");
more ▼

answered Dec 12 '18 at 11:14 PM

avatar image

Shadowriver
33.2k 915 164 1088

avatar image Theopathy Dec 12 '18 at 11:22 PM

Still getting the same error, thank you for this though. Will keep it in.

avatar image Theopathy Dec 12 '18 at 11:32 PM

Okay it seems to be that "k_EUniversePublic" is causing it.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question