尝试使用 Visual Studio 2017 但 运行 进入 E0145 创建 gRPC 项目

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

我在 Linux 上成功学习了本教程:https://grpc.io/docs/quickstart/cpp/
( gRPC 版本: v1.28.1 )
然后我更改了 helloworld.proto 文件并重新生成了 grpc.pb.cc、pb.cc、grpc.pb.h、pb.h 文件。
然后我将这些文件复制到 Windows 10 机器 Visual Studio 2017.
我使用 vcpkg 安装 grpc。 (天哪,这一步用了45分钟...)
我启动了一个新的控制台项目并添加了 helloworld 示例代码。
该项目似乎神奇地找到了 grpc 包含文件。
但是当我尝试编译项目时 IDE 有 175 个错误,其中大多数是 E0145。
例如:
E0145 成员"google::protobuf::Any::kIndexInFileMessages"可能没有初始化

我试过关闭预编译头文件。但是没有用。

有谁知道我怎样才能得到这个运行?

您可以试试这个链接:

  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 "Whosebug" 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"