C++ -- google.protobuf.Any -- descriptor_table_google_2fprotobuf_2fany_2eproto

440 views
Skip to first unread message

gedden

unread,
Apr 10, 2022, 1:45:30 PM4/10/22
to Protocol Buffers
I have a proto  file which uses the "Any" type. 


Client.proto
import "google/protobuf/Any.proto";
...
message ClientConnectivityMessage
{
    ClientToServerConnectivityMessageSubtype Subtype = 1;
    google.protobuf.Any Request = 2;
}


I have generated functional (production) protocols for java and C# from this way back 3.0.0-beta. I am updating my programs to use Java / C++ and am switching to 3.20.0. I can generate the *.pb.cc & *.pb.h files just fine. The generated Client.pb.cc file has a descriptor in in that references the google protof Any (as expected)
descriptor_table_google_2fprotobuf_2fAny_2eproto

When attempting to compile with this file, I get the error:
>  error C2039: 'descriptor_table_google_2fprotobuf_2fAny_2eproto': is not a member of '`global namespace''
> 'descriptor_table_google_2fprotobuf_2fAny_2eproto': undeclared identifier


To me, this implies that the descriptor itself does not exist. However I do see this line in any.bp.h
> PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fany_2eproto;

Which implies to me that it does in fact exist, but is somehow 'internal' and 'extern'?
* Its in a header that is included
* files generated from .proto definitions that do not include references to 'Any' seem to work & compile just fine.
* I am generating these .cc files with the same version i'm attempting to compile against. (3.20.0)

Any appears to still be a supported type, what am I missing here?

Any help would be greatly appreciated. 

gedden

unread,
Apr 10, 2022, 11:13:46 PM4/10/22
to Protocol Buffers
Going to leave this here in case anyone else hits this issue. 

Its: 
>  import "google/protobuf/any.proto";

Not
>  import "google/protobuf/Any.proto";

The protoc C++ will generate invalid externs, aka
>  descriptor_table_google_2fprotobuf_2fany_2eproto !=  descriptor_table_google_2fprotobuf_2fAny_2eproto

Reply all
Reply to author
Forward
0 new messages