使用gcc-13.2编译absl-cpp会出现以下报错:
third_party/abseil-cpp/absl/strings/internal/str_format/extension.h:34:6: warning: elaborated-type-specifier for a scoped enum must not use the ‘class’ keyword
34 | enum class FormatConversionChar : uint8_t;
| ~~~~ ^~~~~
| -----
third_party/abseil-cpp/absl/strings/internal/str_format/extension.h:34:33: error: found ‘:’ in nested-name-specifier, expected ‘::’
34 | enum class FormatConversionChar : uint8_t;
| ^
| ::
third_party/abseil-cpp/absl/strings/internal/str_format/extension.h:34:12: error: ‘FormatConversionChar’ has not been declared
34 | enum class FormatConversionChar : uint8_t;
| ^~~~~~~~~~~~~~~~~~~~
third_party/abseil-cpp/absl/strings/internal/str_format/extension.h:35:6: warning: elaborated-type-specifier for a scoped enum must not use the ‘class’ keyword
35 | enum class FormatConversionCharSet : uint64_t;
| ~~~~ ^~~~~
| -----
third_party/abseil-cpp/absl/strings/internal/str_format/extension.h:35:36: error: found ‘:’ in nested-name-specifier, expected ‘::’
35 | enum class FormatConversionCharSet : uint64_t;
| ^
| ::
third_party/abseil-cpp/absl/strings/internal/str_format/extension.h:35:12: error: ‘FormatConversionCharSet’ has not been declared
35 | enum class FormatConversionCharSet : uint64_t;
| ^~~~~~~~~~~~~~~~~~~~~~~
third_party/abseil-cpp/absl/strings/internal/str_format/extension.h:131:6: warning: elaborated-type-specifier for a scoped enum must not use the ‘class’ keyword
131 | enum class Flags : uint8_t {
| ~~~~ ^~~~~
| -----
third_party/abseil-cpp/absl/strings/internal/str_format/extension.h:131:18: error: found ‘:’ in nested-name-specifier, expected ‘::’
131 | enum class Flags : uint8_t {
| ^
| ::
解决办法:
前往third_party/abseil-cpp/absl/strings/internal/str_format/extension.h该文件,添加一行代码
#define ABSL_STRINGS_INTERNAL_STR_FORMAT_EXTENSION_H_ #include <limits.h> +#include <stdint.h> //在这个位置添加这行代码 #include <cstddef> #include <cstring>标签:gcc,abseil,grpc,enum,fails,absl,internal,cpp,class From: https://blog.csdn.net/sandmana/article/details/143688822