我试图按照这个例子来加载数据并将它们发送到服务器。
CertainStructure_t *cs = 0;
ber_decode(0, &asn_DEF_CertainStructure, &cs, buffer, buffer_length);
cs->val1 = 123; /* Modify the contents */
der_encode(&asn_DEF_CertainStructure, cs, write_handle, 0);
我写了这段代码
Message01_t *a;
a->number = 123;
der_encode(&Message01, a, write_handle, 0);
Message01的描述是
Message01 ::= SEQUENCE
{
number INTEGER -- inital integer
}
我收到了这个错误
error: incompatible types in assignment
error: ‘Message01’ undeclared (first use in this function)
答案 0 :(得分:0)
假设这是http://lionet.info/asn1c/asn1c.cgi
上的在线ASN.1编译器只是试图让它编译....不知道我在做什么:
以下刚编译:
#include <Message01.h>
int write_handle(void const*, unsigned long, void*) {
// no idea what this is
return 0;
}
int main() {
Message01_t *a=new Message01_t(); // Must be created/allocated/whatever
a->number = 123;
der_encode(&asn_DEF_Message01, a, write_handle, 0);
}
注意: