asn1c icon indicating copy to clipboard operation
asn1c copied to clipboard

Compiling asn1c output on Windows

Open ronMilne opened this issue 7 years ago • 9 comments

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

ronMilne avatar May 09 '18 22:05 ronMilne

Hi @ronMilne,

Yes, it should be possible.

velichkov avatar May 10 '18 06:05 velichkov

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

ronMilne avatar May 10 '18 21:05 ronMilne

The answer is still yes.

mouse07410 avatar May 10 '18 21:05 mouse07410

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

ronMilne avatar May 11 '18 03:05 ronMilne

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 avatar May 11 '18 10:05 velichkov

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

velichkov avatar May 11 '18 10:05 velichkov

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 avatar Feb 05 '21 10:02 delinage

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.

intrstlr avatar Nov 29 '22 14:11 intrstlr

Are we STILL having this issue?

sfhacker avatar Apr 02 '23 20:04 sfhacker