开发者

Google Protocol Buffers. C++ error: 'protobuf' does not name a type

I have the following code which I'm really struggling to compile:

#include <stdio.h>
#include <stdlib.h>
#include "test.pb.h"

using namespace google::protobuf;
using namespace std;


protobuf::RpcChannel* channel;   //error on this line!

I keep getting this 'protobuf' does not name a type error. I have no idea how to fix this ;(

An开发者_运维百科y insight greatly appreciated.

Many thanks in advance,


There is no protobuf namespace, since you did using namespace google::protobuf (which you shouldn't). Do namespace protobuf = google::protobuf instead.


You need to include #include "google\protobuf\service.h" in the file you are using RpcChannel not in the headers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜