0

So I've started implementing Steamworks functions for my game, and everything went perfectly fine. I managed to get sync with steam API ( i can do achievements and see that i'm playing game on my steam acc). However when i wanted to start using some functions that they provided, my engine is saying:

error LNK2019: unresolved external symbol

Anyone can help me solve this problem? I'm aiming atm at reading and saving score in Leaderboards. Any good advices for me ? :D

Code sample that gives me error:

    int MyCodeLibrary::TryGetScore()
{
    if (SteamAPI_Init())
    {
        CSteamLeaderboards obj();
        obj().FindLeaderboard("test");
        obj().DownloadScores();
        return 0;
    }
    else
    {
        return 0;
    }
}

Also tried to get to Steam with OnlineSubsystem like this:

void MyCodeLibrary::UpdateScoreInt(int score, FName board, APlayerController* PlayerController)
{
    OutputDebugStringA("Funkcja jest wywoływana");
    if (SteamAPI_Init())
    {
        OutputDebugStringA("Steam API działa");
        ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(PlayerController->Player);
        IOnlineSubsystem* ion = IOnlineSubsystem::Get(FName("Steam"));
        TSharedPtr<const FUniqueNetId> UserId = ion->GetIdentityInterface()->GetUniquePlayerId(LocalPlayer->GetControllerId());
        ion->GetLeaderboardsInterface();

        FOnlineLeaderboardWrite wrt;
        wrt.LeaderboardNames.Add(board);
        wrt.SetIntStat(TEXT("Score"), score);

        if (UserId.IsValid())
        {
            OutputDebugStringA("Mam UserID");
            ion->GetLeaderboardsInterface()->WriteLeaderboards(board, *UserId, wrt);
            printf("Odpalony score");
        }

    }
}
Avengar
  • 89
  • 2
  • 9
  • 1
    You aren't linking in some Steamworks library, I presume. Can you at least show us what symbol it is missing exacly? – arrowd Feb 23 '17 at 19:45
  • Unfortunetly, I don't have access to the project ATM but i can do it tomorrow. I know for sure there is Steam_api.h linked but never seen mentioned any other needed :/ – Avengar Feb 23 '17 at 19:58
  • Including a header isn't enough. You need to link in some **libraries**. – arrowd Feb 23 '17 at 20:03
  • Okay, then there is something I've never done before. Can you explain how can i do this? – Avengar Feb 23 '17 at 20:36
  • If you are using VS, it is "Project settings" -> "Linker" -> "Additional libraries", or something like that. – arrowd Feb 23 '17 at 20:41
  • I'll test that Ty :3 – Avengar Feb 23 '17 at 20:50

1 Answers1

0

So, I've included library "steam_api64.lib" in my source, but after that i've recieved lots of error which suggest that everyting in steam_api.h is wrong :/

I'm pretty new to it, so would appreciate some furthere help with it. Here are examples of errors showing:

error C2371: "S_CALLTYPE": redefinition; different basic types

error C4430: missing type specifier-int assumed. Note C++ does not support default-int

Did I included anything wrong or missing something? Steam_api.h file is downloaded directly from steamworks and has not been modified.

Adrian Rozlach
  • 51
  • 2
  • 12
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. – nothrow Feb 24 '17 at 11:24
  • I could not leave post under author.Sorry for inconvinience, i've just wanted to share my progress in problem couse i have the same one. – Adrian Rozlach Feb 24 '17 at 11:33
  • Feel free asking new question. The problem you are facing is different from the one asked in original post. – nothrow Feb 24 '17 at 11:35