On Thu, Apr 22, 2010 at 07:02, petriborg <petrib...@gmail.com> wrote:
> Hi
>
> I've created a very simple protobuf test to play with the reflection/
> descriptors, but whenever I try to use the descriptor returned by
> GetDescriptor() I get errors out of g++. What am I doing wrong?

you might want to include descriptor.h

>
> I'm using Protobuf 2.3 on Linux
>
> Code:
> #include <string>
> #include <iostream>
> #include "test.pb.h"
> namespace g = google::protobuf;
> int main() {
>    std::cout << "START\n";
>    tsi::Time t;
>    const g::Descriptor* desc = t.GetDescriptor();
>    std::string s = desc->name();
>    std::cout << "END\n";
> }
>
> Proto:
> package tsi;
> message Time {
>    optional int64 milliseconds = 1;    // Milliseconds since epoch
> }
>
> Error:
> ~/dev/pbdesc$ make all
> LD_LIBRARY_PATH=/home/coonerp/dev/pbdesc/protobuf/lib /home/coonerp/
> dev/pbdesc/protobuf/bin/protoc --cpp_out=. test.proto
> g++ -o test.pb.o -I/home/coonerp/dev/pbdesc/protobuf/include -c
> test.pb.cc
> g++ -o main.o -I/home/coonerp/dev/pbdesc/protobuf/include -c main.cc
> main.cc: In function ‘int main()’:
> main.cc:16: error: invalid use of incomplete type ‘const struct
> google::protobuf::Descriptor’
> /home/coonerp/dev/pbdesc/protobuf/include/google/protobuf/
> extension_set.h:52: error: forward declaration of ‘const struct
> google::protobuf::Descriptor’
> make: *** [all] Error 1
>
> --
> 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 
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
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 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to