views:

37

answers:

2
#include <google/protobuf/io/coded_stream.h>
namespace google::protobuf::io

....
int fd = open("myfile", O_WRONLY);
ZeroCopyOutputStream* raw_output = new FileOutputStream(fd);
CodedOutputStream* coded_output = new CodedOutputStream(raw_output);

The above is following the tutorial here, but when I compile get the following errors:

error C2061: syntax error : identifier 'io'

What can be wrong here?

UPDATE

When I changed the above to using namespace google::protobuf::io; I get a new error saying the symbol FileOutputStream is not defined, how come?

+1  A: 

Don't you mean

using namespace google::protobuf::io;
Steve Townsend
A: 
#include <google/protobuf/io/coded_stream.h>
namespace google::protobuf::io

This is ill-formed. You need to be using namespace google::protobuf::io;, I'm guessing from the rest of the posted code.

How come is that the code segment for the top is for that header only, and the tutorial depends on the whole library. You're just copy and pasting code without even understanding it. I'm not going to sit here and debug every error you could possibly come up against. You will have to actually read the library pages and know C++ first.

DeadMG
Thanks man!After this change I get a new error, how come?
How come is that the code segment for the top is for that header only, and the tutorial depends on the whole library. You're just copy and pasting code without even understanding it. I'm not going to sit here and debug every error you could possibly come up against.
DeadMG