apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ISF - Hassan Shabbir <hassanshab...@isf.com.pk>
Subject ERROR : (.text+0x3d): undefined reference to `apr_initialize'
Date Fri, 28 Apr 2006 06:34:51 GMT
Dear

I am working in Linux SUSE environment . 
I am new to APR . I have made the sample program in C (gcc) using APR 
library .
Every Time I run the program this error occurs : 

ERROR : (.text+0x3d): undefined reference to `apr_initialize'

I have checked the paths for the apr include and lib folders . They are 
correct. 

The sample program is given below.


#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

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

#include <apr_general.h>
#include <apr_pools.h>

#define MEM_ALLOC_SIZE		1024


int main(int argc, const char *argv[])
{
	
	system("clear");
	
	printf("\n\n\t\t\t\t\t\tIN MAIN\n\n");
    apr_status_t rv;
    apr_pool_t *mp;
    char *buf1;
    char *buf2;

    // per-process initialization //
   rv = apr_initialize();
    //rv = apr_app_initialize(&argc,argv,NULL);	
    if (rv != APR_SUCCESS) {
        assert(0);
        return -1;
    }

    // create a memory pool. //
    apr_pool_create(&mp, NULL);

    // allocate memory chunks from the memory pool //
    buf1 = apr_palloc(mp, MEM_ALLOC_SIZE);
    buf2 = apr_palloc(mp, MEM_ALLOC_SIZE);

    // destroy the memory pool. These chunks above are freed by this //
    apr_pool_destroy(mp);

    apr_terminate();
	printf("\n\n\t\t\t\t\t\tSUCCESSFUL\n\n");
    return 0;
}

---------------------------------------------------------------------
The complete error information is given below:
---------------------------------------------------------------------

gcc -c -I/usr/local/include/subversion-1 -I/usr/local/apr/include/apr-0 test.c 
-o test.o -L/usr/local/lib -L/usr/local/apr/lib
gcc -o test test.o -L/usr/local/lib -L/usr/local/apr/lib
test.o: In function `main':
test.c:(.text+0x3d): undefined reference to `apr_initialize'
collect2: ld returned 1 exit status
make: *** [all] Error 1

--------------------------------------------
The make file is given below :
-------------------------------------------

INC=-I/usr/local/include/subversion-1 -I/usr/local/apr/include/apr-0
LIB=-L/usr/local/lib -L/usr/local/apr/lib

all:
	gcc -c $(INC) test.c -o test.o $(LIB)
	gcc -o test test.o $(LIB)
	./test
clean:
	rm -f test.o
	
kindly reply me as soon as possible . I shall be grateful to you for this act 
of kindness.

Regards,

Hassan Shabbir


Mime
View raw message