Skip to content

Build fails #335

Description

@Chaojimengnan

I used VS2022 and CMake version 3.21.1 for the build. Here is my error message:

[build] D:\base\projects\s2client-api\contrib\protobuf\src\google/protobuf/repeated_field.h(294,38): error C2374: 'kRepHeaderSize': redefinition; multiple initialization [D:\base\projects\s2client-api\output\x64\Release\contrib\protobuf\cmake\libprotobuf.vcxproj]
[build] D:\base\projects\s2client-api\contrib\protobuf\src\google/protobuf/repeated_field.h(294): message : see declaration of 'kRepHeaderSize' [D:\base\projects\s2client-api\output\x64\Release\contrib\protobuf\cmake\libprotobuf.vcxproj]
[build] D:\base\projects\s2client-api\contrib\protobuf\src\google/protobuf/repeated_field.h(295): message : while compiling class template static data member 'const size_t google::protobuf::RepeatedField<google::protobuf::int32>::kRepHeaderSize' [D:\base\projects\s2client-api\output\x64\Release\contrib\protobuf\cmake\libprotobuf.vcxproj]
[build] D:\base\projects\s2client-api\contrib\protobuf\src\google/protobuf/repeated_field.h(1043): message : while compiling class template member function 'int google::protobuf::RepeatedField<google::protobuf::int32>::size(void) const' [D:\base\projects\s2client-api\output\x64\Release\contrib\protobuf\cmake\libprotobuf.vcxproj]
[build] D:\base\projects\s2client-api\contrib\protobuf\src\google/protobuf/descriptor.pb.h(4052): message : see reference to function template instantiation 'int google::protobuf::RepeatedField<google::protobuf::int32>::size(void) const' being compiled [D:\base\projects\s2client-api\output\x64\Release\contrib\protobuf\cmake\libprotobuf.vcxproj]
[build] D:\base\projects\s2client-api\contrib\protobuf\src\google/protobuf/descriptor.pb.h(509): message : see reference to class template instantiation 'google::protobuf::RepeatedField<google::protobuf::int32>' being compiled [D:\base\projects\s2client-api\output\x64\Release\contrib\protobuf\cmake\libprotobuf.vcxproj]
[build]   field_mask.pb.cc
[build]   generated_message_reflection.cc
[build] D:\base\projects\s2client-api\contrib\protobuf\src\google/protobuf/repeated_field.h(294,38): error C2374: 'kRepHeaderSize': redefinition; multiple initialization [D:\base\projects\s2client-api\output\x64\Release\contrib\protobuf\cmake\libprotobuf.vcxproj]
[build] D:\base\projects\s2client-api\contrib\protobuf\src\google/protobuf/repeated_field.h(294): message : see declaration of 'kRepHeaderSize' [D:\base\projects\s2client-api\output\x64\Release\contrib\protobuf\cmake\libprotobuf.vcxproj]
[build] D:\base\projects\s2client-api\contrib\protobuf\src\google/protobuf/repeated_field.h(295): message : while compiling class template static data member 'const size_t google::protobuf::RepeatedField<google::protobuf::int32>::kRepHeaderSize' [D:\base\projects\s2client-api\output\x64\Release\contrib\protobuf\cmake\libprotobuf.vcxproj]
[build] D:\base\projects\s2client-api\contrib\protobuf\src\google/protobuf/repeated_field.h(1043): message : while compiling class template member function 'int google::protobuf::RepeatedField<google::protobuf::int32>::size(void) const' [D:\base\projects\s2client-api\output\x64\Release\contrib\protobuf\cmake\libprotobuf.vcxproj]
[build] D:\base\projects\s2client-api\contrib\protobuf\src\google/protobuf/descriptor.pb.h(4052): message : see reference to function template instantiation 'int google::protobuf::RepeatedField<google::protobuf::int32>::size(void) const' being compiled [D:\base\projects\s2client-api\output\x64\Release\contrib\protobuf\cmake\libprotobuf.vcxproj]
[build] D:\base\projects\s2client-api\contrib\protobuf\src\google/protobuf/descriptor.pb.h(509): message : see reference to class template instantiation 'google::protobuf::RepeatedField<google::protobuf::int32>' being compiled [D:\base\projects\s2client-api\output\x64\Release\contrib\protobuf\cmake\libprotobuf.vcxproj]

This looks like protobuf's problem, here is the definition of kRepHeaderSize, I don't think there is something wrong, but it gets error

template<typename Element>
const size_t RepeatedField<Element>::kRepHeaderSize =
    reinterpret_cast<size_t>(&reinterpret_cast<Rep*>(16)->elements[0]) - 16;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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