Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, all. I've got problems when I tried to compile a .c file which contains codes of calling perl functions. I made the code according to the perlembed documentation. The perl function can be called successfully from my another test.c file. Any suggestions will be appreciated. The command that I used for compiling is:
gcc -g -pedantic-errors -DBTDEBUG -I/usr/lib/perl5/5.8.0/i386-linux- +thread-multi/CORE -Wall -D__USE_FIXED_PROTOTYPES__ -I. -I.g -I/usr/ +X11R6/include `perl -MExtUtils::Embed -e ccopts` -DPERL_POLLUTE -o Li +nux_x86_glibc-2.3.2_gcc.debug/am_string.o -c am_string.c
The error messages I got are:
/usr/include/netdb.h:480: ISO C89 does not support `static' or type qu +alifiers in parameter array declarators In file included from am_string.c:16: /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/perl.h:3841:24: ISO +C does not permit named variadic macros am_string.c:816:54: ISO C99 requires rest arguments to be used am_string.c:861:42: ISO C99 requires rest arguments to be used am_string.c: In function `mk_string_from_line_without_quoted_newlines' +: am_string.c:924: ISO C89 forbids mixed declarations and code am_string.c:928: ISO C forbids braced-groups within expressions am_string.c:928: ISO C forbids braced-groups within expressions am_string.c:932: ISO C forbids braced-groups within expressions am_string.c:979:70: ISO C99 requires rest arguments to be used am_string.c:993:54: ISO C99 requires rest arguments to be used
Thanks!

update (broquaint) - added <code> tags

Replies are listed 'Best First'.
Re: compiling problems of calling perl from C
by Tanalis (Curate) on Jun 23, 2005 at 06:51 UTC
    Can you provide some code? It'd be useful to see the lines the compiler's kicking out, if nothing else ...
Re: compiling problems of calling perl from C
by cosimo (Hermit) on Jun 24, 2005 at 10:53 UTC

    Seems like you should drop -pedantic-errors and replace it with -pedantic. The ISO Cxx warnings are treated like errors, but should really be only (yea) warnings.

    Probably you already knew this...