我需要 asn1 BER 编码器/解码器,并发现它是“asn1c”编译器的一部分(这里是链接 http://lionet.info/asn1c/blog/)。
我使用“configure、make、make install”过程编译整个东西没有问题,但似乎不可能单独编译它。
我正在尝试将此包的 BER 编码器/解码器功能编译到 NetBeans 中的静态库中。然而,我对一些“包含”废话有很大的问题。这是一个例子...
在 asn1parser.h 文件中,有一个名为“asn1c_integer_t”的新类型的 typedef
//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:错误:在“asn1c_integer_t”之前应有“=”、“,”、“;”、“asm”或“attribute”
谁能帮我解决这个问题吗?
您在“其中一些文件”中尝试过
#include "asn1parser.h"
吗?也许它们也包含在其他地方,此时,编译器不知道名称 asn1c_integer_t
。
我确信“包含”是造成问题的原因,但是,问题出在这一行
typedef intmax_t asn1c_integer_t;
显然我的 gcc 版本无法识别这个 intmax_t 类型。我把它换成简单的“int”,现在它可以工作了:D