There shouldn't be any problem with omitting the package. The declarations
in your error message should not be appearing more than once. I can't tell
much from the error message. Can you investigate the generated code and see
whether it is actually double-declaring these things? If so, please send us
a sample. But my guess is that something is weird about your environment,
e.g. maybe your build system likes to concatenate multiple source files and
compile them at once (some build systems do this), which doesn't work in the
presence of anonymous namespaces.
On Mon, Mar 29, 2010 at 6:44 PM, Adam Schepis <adam.sche...@gmail.com>wrote:
> Having an error using code generated by protobuf (c++) version 2.2.0.
> I include a bunch of generated .pb.cc files generated from .proto
> files, none of which have packages defined.
> as a result i'm getting a bunch of strange errors:
> Error 1 error C2086: 'google::protobuf::GoogleOnceType `anonymous-
> namespace'::protobuf_AssignDescriptors_once_' : redefinition h:\src
> \project\trunk\src\trayicon\RegisterUserReq.pb.cc 57 TrayIcon
> Error 2 error C2084: function 'void `anonymous-
> namespace'::protobuf_AssignDescriptorsOnce(void)' already has a body h:
> \src\project\trunk\src\trayicon\RegisterUserReq.pb.cc 58 TrayIcon
> Error 3 error C2084: function 'void `anonymous-
> namespace'::protobuf_RegisterTypes(const std::string &)' already has a
> body h:\src\project\trunk\src\trayicon\RegisterUserReq.pb.cc 63
> Error 4 error C3861: 'protobuf_AssignDescriptorsOnce': identifier
> found h:\src\project\trunk\src\trayicon\RegisterUserReq.pb.cc 64
> Error 5 error C3861: 'protobuf_AssignDescriptorsOnce': identifier
> found h:\src\project\trunk\src\trayicon\RegisterUserReq.pb.cc 112
> ...and the list goes on.
> My gut is telling me that this has something to do w/ the lack of
> packages, but i dont want to add them to the .protos because there are
> a lot of teams that depend on these .proto files and it would cause a
> lot of code changes for them to have to start using the new namespace
> in all the code where they use these messages. The other teams are
> still using protobuf 2.0.3 which apparently doesnt have this problem.
> any solutions to this or am i stuck?
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to proto...@googlegroups.com.
> To unsubscribe from this group, send email to
> For more options, visit this group at
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to
For more options, visit this group at