[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Fail to compile.
Greetings,
Is there anyone has experiencing the same problem with
me? I just make an example using ldap_init function, it's
so simple, but it fails when I compile it.
This is my source code (example.c):
------
#include <stdlib.h>
#include <stdio.h>
#include <ldap.h>
int main (int argc, char **argv)
{
LDAP *myLDAP;
char myHost[] = "152.118.26.171";
int myPort = 389;
myLDAP = ldap_init(myHost, myPort);
if (myLDAP==NULL) {
fprintf(stdout, "ldap_init failed!\n");
}
else {
fprintf(stdout, "ldap_init successful!\n");
}
return 0;
}
------
This one is my Makefile:
------
CC=gcc
CFLAGS= -g -Wall
LIBS= -llber -lldap
EXAMPLES=example
all: $(EXAMPLES)
example: example.o
$(CC) $(CFLAGS) -o example example.o $(LIBS)
clean:
rm -f $(EXAMPLES) *.o
------
and here is the result:
------
/usr/local/lib/libldap.so: undefined reference to `res_query'
/usr/local/lib/libldap.so: undefined reference to `dn_expand'
collect2: ld returned 1 exit status
make: *** [example] Error 1
------
I have installed OpenLDAP 2.0.7 with default parameter.
How can I solve the problem? Thanks in advance.
Regards,
Permono, R.