ValveSoftware/GameNetworkingSockets

SteamNetworkingMessages returning nullptr?

lolriven opened this issue · 1 comments

#include <iostream>
#include <steam/isteamnetworkingmessages.h>
#include <steam/steamnetworkingtypes.h>
#include <thread>
int main()
{
    SteamNetworkingIdentity sni ;
    memset(&sni,0,sizeof(SteamNetworkingIdentity));
    sni.m_eType = k_ESteamNetworkingIdentityType_IPAddress;
    SteamNetworkingIPAddr ip;
    memset(&ip,0,sizeof(SteamNetworkingIPAddr));
    ip.SetIPv6LocalHost(8888);
    sni.SetIPAddr(ip);
    ISteamNetworkingMessages* snm = SteamNetworkingMessages();
    if(snm == nullptr)
    {
        fprintf(stderr,"bad pointer\n");
        exit(0);
    }
    
    return 0;
}

Any idea what might be causing this?

Ah, I realised I have to called Init on the functions. Sorry!