Generated code fails to compile with odd errors under XCode 3.0

443 views
Skip to first unread message

kelleyk

unread,
Aug 16, 2008, 3:31:04 AM8/16/08
to Protocol Buffers
I've just downloaded and installed protobuf. The library installed
just fine, and the included examples compile and run correctly on the
command line. That is, something like "c++ foo-example.cc foo-
protocol.pb.cc -lprotobuf -o foo-example" completes without error and
produces a working binary.

However, when I try to have Xcode compile the same foo-protocol.pb.cc
(even just that file alone, apart from the rest of the project), I get
278 errors in the protobuf headers. Here are the first few:

/usr/local/include/google/protobuf/descriptor.h:250: error: expected
identifier before numeric constant
/usr/local/include/google/protobuf/descriptor.h:250: error: expected
`}' before numeric constant
/usr/local/include/google/protobuf/descriptor.h:250: error: expected
unqualified-id before numeric constant
/usr/local/include/google/protobuf/descriptor.h:307: error: non-member
function 'const std::string& google::protobuf::name()' cannot have cv-
qualifier
/usr/local/include/google/protobuf/descriptor.h:308: error: non-member
function 'const std::string& google::protobuf::full_name()' cannot
have cv-qualifier
/usr/local/include/google/protobuf/descriptor.h:309: error: non-member
function 'const google::protobuf::FileDescriptor*
google::protobuf::file()' cannot have cv-qualifier
/usr/local/include/google/protobuf/descriptor.h:310: error: non-member
function 'bool google::protobuf::is_extension()' cannot have cv-
qualifier
/usr/local/include/google/protobuf/descriptor.h:311: error: non-member
function 'int google::protobuf::number()' cannot have cv-qualifier

Nothing fancy exists in this project. I have simply created an empty
Xcode project, added the .proto file and a script build stage that
runs protoc, and hit "go." I'd assume this is a problem in how Xcode
sets up its projects by default, but I'm out of ideas about what might
be going wrong.

Help! Does anyone have any advice?

Thanks in advance,
Kevin

Kenton Varda

unread,
Aug 18, 2008, 3:59:06 PM8/18/08
to kelleyk, Protocol Buffers
On Sat, Aug 16, 2008 at 12:31 AM, kelleyk <kel...@mit.edu> wrote:
/usr/local/include/google/protobuf/descriptor.h:250: error: expected
identifier before numeric constant
/usr/local/include/google/protobuf/descriptor.h:250: error: expected
`}' before numeric constant
/usr/local/include/google/protobuf/descriptor.h:250: error: expected
unqualified-id before numeric constant

These errors suggest that someone #defined TYPE_BOOL as a macro.  I think the rest of the errors are the result of the compiler being confused after this error.
Reply all
Reply to author
Forward
0 new messages