delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/03/17/07:27:53

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Sat, 17 Mar 2012 12:26:59 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: argp - Missing initializer and _argp_parse undefined reference
Message-ID: <20120317112659.GG19107@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <CAM5i6Pjxq1pZG95=t7OmT-RMv7nY+AL9ivkpZnW6+mAoUpTYkg AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <CAM5i6Pjxq1pZG95=t7OmT-RMv7nY+AL9ivkpZnW6+mAoUpTYkg@mail.gmail.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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/libargp.la
> 
> 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

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

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019