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]

argp - Missing initializer and _argp_parse undefined reference


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 ?

Here's the full source I was using for my compiles but using example
#1 from the docs also produces the same error:

/* socket1.c - Simple socket client server application
 *
 */

#include <stdio.h>
#include <stdlib.h>
#include <argp.h>

const char *argp_program_version = "socket1 v0.99.0";
const char *argp_program_bug_address = "<bugs@somedomain.com>";
static char doc[]="socket1 [--server] --socket <path>";
static struct argp argp = {0,0,0,doc,0,0,0};

int main(int argc, char *argv[]){
        int retVal=EXIT_SUCCESS;

        argp_parse(&argp, argc, argv, 0, 0, 0);

        return retVal;
}

Thanks,
jw

-- 
Tao of Programming - "Without the wind, the grass does not move.
Without software, hardware is useless."

Attachment: cygcheck.out
Description: Binary data

--
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

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