开发者

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

开发者 https://www.devze.com 2023-03-26 17:41 出处:网络
I have the following code which I\'m really struggling to compile: #include <stdio.h> #include <stdlib.h>

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

精彩评论

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