问题
I have installed the osmocom asn1c compiler, the aper-prefix
branch, to obtain an implementation of the TCAP protocol.
I have used the respective script to compile the ".asn" files.
The C files are generated successfully, but when compiling the obtained C code, an error is raised, which is related to this line of code:
#include <EXTERNAL.h>
In fact, the file EXTERNAL.h is missing (seemingly, the EXTERNAL type is not supported by this compiler). Is anyone aware of this problem and a possible solution?
回答1:
You have several options:
Use a newer version of asn1c from this PR (still not merged)
Copy the EXTERNAL.h from the osmocom repository
Rename
EXTERNAL
toEXTERNALt
in all asn files and add the following in the asn files that has EXTERNALt.-- -- From "ITU-T Recommendation X.208", "34 The external type" -- EXTERNALt ::= [UNIVERSAL 8] IMPLICIT SEQUENCE {direct-reference OBJECT IDENTIFIER OPTIONAL, indirect-reference INTEGER OPTIONAL, data-value-descriptor ObjectDescriptor OPTIONAL, encoding CHOICE {single-ASN1-type [0] ANY, octet-aligned [1] IMPLICIT OCTET STRING, arbitrary [2] IMPLICIT BIT STRING}}
Or add it in a separate asn file and import where needed.
来源:https://stackoverflow.com/questions/53632962/problem-in-compiling-c-code-generated-by-osmocom-asn1c