我需要asn1 BER编码器/解码器,并发现它是“asn1c”编译器的一部分(这里是http://lionet.info/asn1c/blog/链接)。
我使用“配置,制作,安装”过程编译整个程序没有问题,但似乎无法单独编译。
我正在尝试将此包的BER编码器/解码器功能编译为NetBeans中的静态库。但是,我遇到一些“包含”废话的大问题。这是一个例子
在asn1parser.h文件中,有一个新类型的typedef,称为“asn1c_integer_t”
//some preprocessor statements removed to keep this post short...
typedef intmax_t asn1c_integer_t;
#include "asn1p_list.h"
#include "asn1p_oid.h" /* Object identifiers (OIDs) */
#include "asn1p_ref.h" /* References to custom types */
etc...
但是,先前文件中包含的某些文件(例如,asn1p_oid.h)正在使用先前文件中定义的新数据类型。
#ifndef ASN1_PARSER_OID_H
#define ASN1_PARSER_OID_H
typedef struct asn1p_oid_arc_s {
asn1c_integer_t number; /* -1 if not yet defined */
char *name; /* 0 if not defined */
} asn1p_oid_arc_t;
etc...
这对我来说毫无意义,而且我不断收到如下错误:
asn1parser.h:32: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘asn1c_integer_t’
谁能帮我解决这个问题?
最佳答案
您是否曾在“其中一些文件”中尝试过#include "asn1parser.h"
?也许它们也包含在其他地方,到那时,名称asn1c_integer_t
对编译器是未知的。
关于c++ - 有人如何定义数据类型,然后在数据类型定义之后立即在同一文件中包含的其他文件中使用它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5039780/