protoc generated .h file has errors in VS2008

136 views
Skip to first unread message

bayWeiss

unread,
Dec 10, 2009, 12:21:48 PM12/10/09
to Protocol Buffers
I cant post the whole generated .h file, but below is a snippet where
for some reason the compiler cant identify the Arc class. The
declaration for Arc is definitely above the below c++ snippet, but it
acts as if it cant recognize it.

---the errors are from VS2008------------------------------

error C4430: missing type specifier - int assumed. Note: C++ does not
support default-int c:\googleprototest\googleprototestcppserver
\person.pb.h 669 GoogleProtoTestCPPServer
error C2143: syntax error : missing ';' before '&' c:\googleprototest
\googleprototestcppserver\person.pb.h 669
error C2838: 'Arc' : illegal qualified name in member declaration c:
\googleprototest\googleprototestcppserver\person.pb.h 669
error C4430: missing type specifier - int assumed. Note: C++ does not
support default-int c:\googleprototest\googleprototestcppserver
\person.pb.h 669

-----here is the generated header snippet from 2.2.0a protoc, within
the Entity class declaration--------

// optional .Square square = 3;
inline bool has_square() const;
inline void clear_square();
static const int kSquareFieldNumber = 3;
inline const ::Square& square() const;
inline ::Square* mutable_square();

// optional .Arc arc = 4;
inline bool has_arc() const;
inline void clear_arc();
static const int kArcFieldNumber = 4;
inline const ::Arc& arc() const; // <- the
problem is here, line 669
inline ::Arc* mutable_arc(); // and
here as well

-------here is the .proto file---------

message Point
{
required double X = 1;
required double Y = 2;
}

message Circle
{
required Point point1 = 1;
required Point point2 = 2;
required Point point3 = 3;
required Point point4 = 4;
}

message Square
{
repeated Point pointList = 1;
}

message Arc
{
required Point center = 1;
required double startAngle = 2;
required double endAngle = 3;
}

message Parameter
{
required double somethingHere = 1;
}

message Entity
{
enum Type { CIRCLE = 1; SQUARE = 2; ARC = 3; }

// Identifies which entity it is.
required Type type = 1;

optional Circle circle = 2;
optional Square square = 3;
optional Arc arc = 4;
}

message Job
{
repeated Entity entity = 1;
}

message Initialize
{
}

message Start
{
}

message MainMessage
{
enum Type { NEW_JOB = 1; INITIALIZE = 2; START = 3;}

// Identifies which field is filled in.
required Type type = 1;

// One of the following will be filled in.
optional Job job = 2;
optional Initialize initialize = 3;
optional Start start = 4;
}



Daniel Wright

unread,
Dec 10, 2009, 5:23:05 PM12/10/09
to bayWeiss, Protocol Buffers
Hmm -- I don't have access to VS2008, but the files generated by 2.2.0a protoc for your .proto compile fine for me in gcc.  Perhaps there's some additional reserved word in VS2008  e.g. what happens if you rename "Arc" to another name?

And just checking -- have you modified the generated files or included headers in any way?




--

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.



Kenton Varda

unread,
Dec 10, 2009, 5:36:25 PM12/10/09
to bayWeiss, Protocol Buffers
The errors suggest to me that somewhere you have #defined Arc as a macro.  Is this possible?

On Thu, Dec 10, 2009 at 9:21 AM, bayWeiss <bzw...@yahoo.com> wrote:

bayWeiss

unread,
Dec 10, 2009, 6:36:37 PM12/10/09
to Protocol Buffers
Ok, some more info.. thanks to your help

So I renamed Arc to ArcShape in the protofile, for example, and it all
works fine.
Funny thing is, if I rename Square to Polyline, I get the same
errors.

If I rename Polyline to PolyLine.. all is ok.

Using Ellipse throws errors also...

So, I guess I cant pin down exactly where the conflict is, but there
must be some geometry objects included with the c++ console project
type i created...

thanks!
> > protobuf+u...@googlegroups.com<protobuf%2Bunsubscribe@googlegroups.c­om>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/protobuf?hl=en.- Hide quoted text -
>
> - Show quoted text -

Daniel Wright

unread,
Dec 10, 2009, 6:46:01 PM12/10/09
to bayWeiss, Protocol Buffers
Maybe ask the compiler for the pre-processed output (sorry, I don't know the VS2008 flag), and search through that for the first appearance of those identifiers.  That'll tell you what header they come from.

Adding a package should fix this kind of problem by putting all of the messages in a c++ namespace.

To unsubscribe from this group, send email to protobuf+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages