在编译grpc的时候报错如下:
[HOSTCXX] Compiling src/compiler/cpp_generator.cc
In file included from third_party/protobuf/src/google/protobuf/stubs/common.h:45:0,
from include/grpc++/impl/codegen/config_protobuf.h:23,
from ./src/compiler/config.h:22,
from ./src/compiler/cpp_generator.h:29,
from src/compiler/cpp_generator.cc:21:
third_party/protobuf/src/google/protobuf/stubs/port.h:263:5: error: this use of "defined" may not be portable [-Werror=expansion-to-defined]
#if GOOGLE_PROTOBUF_USE_UNALIGNED
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
third_party/protobuf/src/google/protobuf/stubs/port.h:263:5: error: this use of "defined" may not be portable [-Werror=expansion-to-defined]
third_party/protobuf/src/google/protobuf/stubs/port.h:263:5: error: this use of "defined" may not be portable [-Werror=expansion-to-defined]
third_party/protobuf/src/google/protobuf/stubs/port.h:263:5: error: this use of "defined" may not be portable [-Werror=expansion-to-defined]
解决方法:
在makefile中修改
CXXFLAGS_opt = -fno-exceptions为CXXFLAGS_opt = -fno-exceptions -Wno-expansion-to-defined

本文解决了在编译GRPC时遇到的特定错误,涉及到如何修改makefile中的CXXFLAGS_opt参数来避免编译警告,确保编译过程顺利进行。
1万+

被折叠的 条评论
为什么被折叠?



