0

我需要 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' 或 '<strong>attribute'</p>

谁能帮我解决这个问题?

4

2 回答 2

0

您是否尝试#include "asn1parser.h"过“其中一些文件”?也许它们也包含在其他地方,此时asn1c_integer_t编译器不知道名称。

于 2011-02-18T09:59:56.360 回答
0

我确信“包含”是造成问题的原因,但是,问题出在这一行

typedef intmax_t asn1c_integer_t;

显然我的 gcc 版本不能识别这个 intmax_t 类型。我把它换成了简单的“int”,现在它可以工作了:D

于 2011-02-22T10:26:06.940 回答