[Date Prev][Date Next] [Chronological] [Thread] [Top]

Compiling examples



Was wondering if I could get a hand.  I am working with the latest
OpenLDAP distribution on a Redhat 7.2 platform.  Everything is installed
in the default locations.  I have been trying to compile the examples in
the LDAP programming book by Howes and Smith to get started writing C
based LDAP applications.  I am apparently having problems linking in the
proper libraries.  Does anyone have a sample Makefile I could use to
assist me in linking the correct libraries in.  Or is there some sample
stuff posted anywhere where I can see what I might be doing wrong.  I
have tried to link in the ldap libraries with the following Makefile.
Any help would be appreciated.  examples.h contains header files and
constant declarations.

EXTRALDFLAGS=-lpthread
LDAPLIB=ldap
LBERLIB=lber
CC=gcc

LIBDIR = /usr/local/lib
LIBS=-L$(LIBDIR) -l$(LDAPLIB) -l$(LBERLIB) $(EXTRALDFLAGS)

PROGS = srch

all: $(PROGS)

srch: srch.o
 $(CC) -o srch srch.o $(LIBS)

srch.o: examples.h

clean:
    rm -f *.o a.out $(PROGS)