我使用thrift编译器生成C-glib文件。但是他们似乎从未编译过。
我的.c文件:
#include "zipkin_core_types.h"
void genLogfile(Span span, char *filename) {
}
我的.h文件
#include "zipkin_core_types.h"
#ifndef SPANLOGGERCH
#define SPANLOGGERCH
void genLogfile(Span span, char *filename);
#endif
命令行选项:
gcc -g -o main -I/usr/include/glib-2.0/ -I /usr/lib/glib/include/ -I/usr/local/include/thrift/ -I/usr/local/include/thrift/c_glib -I. -L/usr/local/lib/-I/usr/lib/glib-2.0/include/ -lthrift main.c zipkin_core_types.c SpanLoggerC.c
我收到5个错误消息屏幕。这里是前几行,它们大多看起来像这样。任何建议都值得赞赏:
In file included from /usr/include/glib-2.0/glib/galloca.h:30,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/glib-2.0/gobject/gtype.h:26,
from /usr/include/glib-2.0/gobject/gboxed.h:26,
from /usr/include/glib-2.0/glib-object.h:25,
from zipkin_core_types.h:11,
from SpanLoggerC.h:1,
from main.c:1:
/usr/include/glib-2.0/glib/gtypes.h:41: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘typedef’
/usr/include/glib-2.0/glib/gtypes.h:90: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
In file included from /usr/include/glib-2.0/glib.h:31,
from /usr/include/glib-2.0/gobject/gtype.h:26,
from /usr/include/glib-2.0/gobject/gboxed.h:26,
from /usr/include/glib-2.0/glib-object.h:25,
from zipkin_core_types.h:11,
from SpanLoggerC.h:1,
from main.c:1:
/usr/include/glib-2.0/glib/garray.h:32: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘G_BEGIN_DECLS’
/usr/include/glib-2.0/glib/garray.h:40: error: expected specifier-qualifier-list before ‘gchar’
/usr/include/glib-2.0/glib/garray.h:66: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/usr/include/glib-2.0/glib/garray.h:69: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/usr/include/glib-2.0/glib/garray.h:73: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token