Skip to content

Build error: Not compiling when BUILD_GRPC_CLIENT is ON #158

@DronCode

Description

@DronCode

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:

  • Is my fix ok?
  • Why grpc not included as dependency in vcpkg.json? How to fix that dependency properly? (I'm not familiar with vcpkg.json)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions