开发者

Google Protocol Buffers. C++ error: ‘google’ has not been declared

开发者 https://www.devze.com 2023-03-26 17:26 出处:网络
I\'m trying to get the following simple C++ program to compile: #include <stdio.h> #include <stdlib.h>

I'm trying to get the following simple C++ program to compile:

#include <stdio.h>
#include <stdlib.h>
using google::protobuf;

int main(void){
    printf("Hello\n")开发者_C百科;
    return 0;
}

I keep getting the following error:

error: ‘google’ has not been declared

I've linked to -lproto and have protobuf-compiler and libprotobuf-dev installed.

I'm totally stuck now.

Anyone have any ideas?

Many thanks in advance,


You don't include any header which declares the google namespace. You should include the header file generated by the protoc compiler; it pulls in the necessary includes.


You forgot to include the header for Protocol Buffers, so the google namespace is not declared.

0

精彩评论

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