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 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: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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