Package Mandatory ?

53 views
Skip to first unread message

Julien PONNOU

unread,
Mar 1, 2012, 9:41:39 AM3/1/12
to Protocol Buffers
Hello,

When I include several couples of .h/.cc in my project, I got the
following errors during the compilation:

error C2086: 'google::protobuf::ProtobufOnceType `anonymous-
namespace'::protobuf_AssignDescriptors_once_' : redefinition
see declaration of '`anonymous-
namespace'::protobuf_AssignDescriptors_once_'
error C2084: function 'void `anonymous-
namespace'::protobuf_AssignDescriptorsOnce(void)' already has a body
see previous definition of 'protobuf_AssignDescriptorsOnce'
error C2084: function 'void `anonymous-
namespace'::protobuf_RegisterTypes(const std::string &)' already has a
body
see previous definition of 'protobuf_RegisterTypes'

Basically, it's telling me these functions are declared in all couples
of .h/.cc. Using a different package for each couple of .h/.cc
corrects the problem, but I don't want to do so. Without using any
package, can someone explain me how to solve this error ?

Best regards,

Julien.

Pherl Liu

unread,
Mar 20, 2012, 3:58:50 PM3/20/12
to Julien PONNOU, Protocol Buffers
The function name is determined by the source proto file path. Looks like you always generate messages from a single .proto file. You would have to generate the message in different files. Otherwise, even if you worked around the function name issue, the runtime DescriptorPool would complained about duplicated file descriptors.


--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To post to this group, send email to prot...@googlegroups.com.
To unsubscribe from this group, send email to protobuf+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.


Reply all
Reply to author
Forward
0 new messages