Trying to create a gRPC project using Visual Studio 2017 but running into E0145

Viewed 265

I successfully followed this tutorial on Linux: https://grpc.io/docs/quickstart/cpp/
( gRPC version: v1.28.1 )
Then I changed the helloworld.proto file and regenerated the grpc.pb.cc, pb.cc, grpc.pb.h, pb.h files.
Then I copied those files to a Windows 10 machine with Visual Studio 2017.
I used vcpkg to install grpc. (Holy cow, this step took 45 minutes... )
I started a new console project and added the helloworld example code.
The project magically seems to find the grpc include files.
But the IDE has 175 errors when I try to compile the project with the majority being E0145.
For example:
E0145 Member "google::protobuf::Any::kIndexInFileMessages" may not be initialized.

I tried turning off precompiled headers. But to no avail.

Does anyone have an idea how I can get this running ?

1 Answers

You can Try this links:

  1. Answer by "developercommunity" form

    "A fix for this issue has been released! Please install the Visual Studio 2019 RC from https://visualstudio.microsoft.com/downloads/ . Thank you for providing valuable feedback which has helped improve the product."

.

  1. Answer by "stackoverflow" form

    "I fixed the first three errors (E0145) by #define BOOST_FILESYSTEM_SOURCE in my application. The last error (E2512) remains. It occurs in the following code: #define BOOST_SYSTEM_REQUIRE_CONST_INIT #if defined(__has_cpp_attribute) #if __has_cpp_attribute(clang::require_constant_initialization) # undef BOOST_SYSTEM_REQUIRE_CONST_INIT # define BOOST_SYSTEM_REQUIRE_CONST_INIT [[clang::require_constant_initialization]] #endif #endif – pras123"

Related