Hi everyone, I'm doing something really obviously wrong, but I don't know what.

I can gcc -c -o file.o file.c  and get a binary object.

I do this for the main and two "helper" .c files

This works, then I get a bunch of .o files.

then you usually do

gcc -o <final executable name> <main.o> <myfile1.o> <myfile2.o>

and gcc does the linking.

In thsi case, myfile2.c uses ldap_init and ldap_simple_bind, and myfile2.h inludes ldap.h.

At this point, there is no ldap.o, just the ldap.h from /usr/include/ldap.h so compile of everything stalls, saying that there is an undefined reference to the function ldap_init and ldap_simple_bind.

Testing indicates that you can do:

int main() {
thingy_do(123);
}

and it will happily do a gcc -c -o main main.c and create the object, which is what it should -- it's not until we link .o's to create a real executable that the system wants to make sure the executable code exists.

The bit that makes me think I'm stupid is that it seems that neither gcc or I can find the source (.c) or compiled binaries (.o) which implement the structures and functions defined in ldap.h. What am I doing wrong? Where are the .c and .o files supposed to be on a regular linux system? Where on gentoo? Have I missed a crucial flag?

Thanks in advance...

--
gentoo-user@gentoo.org mailing list

Reply via email to