apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug MacEachern <do...@covalent.net>
Subject compile/link of apr based programs
Date Tue, 17 Sep 2002 17:10:18 GMT
i'm seeing bits-n-pieces of what the current "proper" way of compiling and 
linking an apr based program is.  would be very helpful to see the 
complete steps given the simple program below.  or is it already 
documented somewhere?

i tried the following:
CFLAGS=`$APR_CONFIG --cflags --includes`
LD_FLAGS=`$APR_CONFIG --libs --ldflags --link-ld`

gcc $CFLAGS $LD_FLAGS -o apr-test apr-test.c

but -laprutil-0 is missing.
i add that, then find i also need to add -L/usr/lib -lgdbm -lexpat -ldb

#include "apr.h"
#include "apr_uri.h"

int main(void) {

    apr_uri_t uri;
    apr_pool_t *p;

    apr_initialize();

    apr_pool_create(&p, NULL);

    apr_uri_parse(p, "http://localhost:8080/", &uri);

    fprintf(stderr, "host=%s\n", uri.hostname);

    apr_terminate();

    return 0;
}


Mime
View raw message