vlm / asn1c

The ASN.1 Compiler
http://lionet.info/asn1c/
BSD 2-Clause "Simplified" License
1.03k stars 553 forks source link

Compiling asn1c output on Windows #278

Open ronMilne opened 6 years ago

ronMilne commented 6 years ago

I've generated c files from an asn1 is it possible to take those files and compile them on a windows machine.

velichkov commented 6 years ago

Hi @ronMilne,

Yes, it should be possible.

ronMilne commented 6 years ago

apologies, I meant i generated the files in Unbuntu then copied them to windows.

mouse07410 commented 6 years ago

The answer is still yes.

ronMilne commented 6 years ago

running gcc on windows I get the following compilation error In file included from ./asn_application.h:11:0, from ./asn_internal.h:12, from INTEGER.c:6: INTEGER.c: In function 'INTEGER__dump': ./asn_system.h:137:21: error: expected ')' before 'PRIdMAX'

define ASN_PRIdMAX PRIdMAX

                 ^

INTEGER.c:152:10: note: in expansion of macro 'ASN_PRIdMAX' "%" ASN_PRIdMAX " (%s)", value, el->enum_name); ^~~ ./asn_system.h:136:21: error: expected ':' before 'PRIuMAX'

define ASN_PRIuMAX PRIuMAX

                 ^

INTEGER.c:164:54: note: in expansion of macro 'ASN_PRIuMAX' ? "%" ASN_PRIuMAX

velichkov commented 6 years ago

Hi @ronMilne,

Try including inttypes.h in asn_system.h. See also http://www.cplusplus.com/reference/cinttypes/ and try to compile the example.

velichkov commented 6 years ago

In case you are using mingw try defining __USE_MINGW_ANSI_STDIO. See: https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/ http://lists.gnu.org/archive/html/bug-gnulib/2015-05/msg00011.html

delinage commented 3 years ago

I'm having a similar error while "Compiling asn1c output on Windows". I get the error " error C2016: C requires that a struct or union has at least one member" because several union are empty. Is there any way to avoid this error without having to add a member in those unions?

intrstlr commented 1 year ago

I'm having a similar error while "Compiling asn1c output on Windows". I get the error " error C2016: C requires that a struct or union has at least one member" because several union are empty. Is there any way to avoid this error without having to add a member in those unions?

@delinage Did you ever get past this issue? I am running in to the same now.