This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: argp - Missing initializer and _argp_parse undefined reference

On Mar 16 21:08, John Wicks wrote:
> Trying to include argp from Shulman's new package but using the
> example code produces a couple errors.
> The first one is missing initializers in the argp structure
> socket1.c:12:15: warning: missing initializer
> socket1.c:12:15: warning: (near initialization for âargp.childrenâ)
> 12: static struct argp argp = {0,0,0,doc};
> I was able to fix that by checking the definition of the structure and
> setting the other three arguments to 0 as well.
> 12: static struct argp argp = {0,0,0,doc,0,0,0};
> The last error after fixing the above is:
> $ gcc -Wall -Wextra -pedantic -o socket1 socket1.c
> /tmp/ccdeH74x.o:socket1.c:(.text+0x45): undefined reference to `_argp_parse'
> collect2: ld returned 1 exit status
> cygcheck -l produces the following:
> $ cygcheck -l libargp
> /usr/bin/cygargp-0.dll
> /usr/include/argp.h
> /usr/lib/libargp.dll.a
> /usr/lib/
> Usually the undefined reference means I'm not including the library.
> Do I have to explicitly include -libargp ?

Of course.  How should gcc know what library you want to link against?
It's just -largp, not -libargp (== option -l with library name without
the leading "lib" and without the trailing ".a".


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]