heroiclabs / nakama-cpp

Generic C/C++ client for Nakama server.
https://heroiclabs.com/docs/cpp-client-guide
Apache License 2.0
75 stars 25 forks source link

Build error: Not compiling when BUILD_GRPC_CLIENT is ON #158

Open DronCode opened 6 months ago

DronCode commented 6 months ago

Hi! I'm trying to build Nakama C++ SDK for UWP with gRPC support. First of all: it requires gRPC dependency, but vcpkg.json does not contains "grpc" dependency, but it's fixable. (just added in local copy and it fix my issue)

Main issue: in core/core-grpc/GrpcClient.cpp used wrong variable (I tested 2.8.4 and v2.8.5 tags).

Current code:

GrpcClient::GrpcClient(const NClientParameters& parameters)
{
    NLOG(NLogLevel::Info, "Created. NakamaSdkVersion: %s", getNakamaSdkVersion());

    _host = parameters.host;
    _ssl = parameters.ssl;
    _platformParams = parameters.platformParams;

    _port = parameters.port;

    if (port == DEFAULT_PORT)
    {
        port = parameters.ssl ? 443 : 7349;
        NLOG(NLogLevel::Info, "using default port %d", port);
    }

    std::string target = parameters.host + ":" + std::to_string(port);

but port variable does not exists. I fixed it locally as

GrpcClient::GrpcClient(const NClientParameters& parameters)
{
    NLOG(NLogLevel::Info, "Created. NakamaSdkVersion: %s", getNakamaSdkVersion());

    _host = parameters.host;
    _ssl = parameters.ssl;
    _platformParams = parameters.platformParams;

    _port = parameters.port;

    if (_port == DEFAULT_PORT)
    {
        _port = parameters.ssl ? 443 : 7349;
        NLOG(NLogLevel::Info, "using default port %d", _port);
    }

    std::string target = parameters.host + ":" + std::to_string(_port);

Questions:

linear[bot] commented 6 months ago

SDK-818 Build error: Not compiling when BUILD_GRPC_CLIENT is ON