1 |
Hi everyone, I'm doing something really obviously wrong, but I don't |
2 |
know what. |
3 |
|
4 |
I can gcc -c -o file.o file.c and get a binary object. |
5 |
|
6 |
I do this for the main and two "helper" .c files |
7 |
|
8 |
This works, then I get a bunch of .o files. |
9 |
|
10 |
then you usually do |
11 |
|
12 |
gcc -o <final executable name> <main.o> <myfile1.o> <myfile2.o> |
13 |
|
14 |
and gcc does the linking. |
15 |
|
16 |
In thsi case, myfile2.c uses ldap_init and ldap_simple_bind, and |
17 |
myfile2.h inludes ldap.h. |
18 |
|
19 |
At this point, there is no ldap.o, just the ldap.h from |
20 |
/usr/include/ldap.h so compile of everything stalls, saying that there |
21 |
is an undefined reference to the function ldap_init and ldap_simple_bind. |
22 |
|
23 |
Testing indicates that you can do: |
24 |
|
25 |
int main() { |
26 |
thingy_do(123); |
27 |
} |
28 |
|
29 |
and it will happily do a gcc -c -o main main.c and create the object, |
30 |
which is what it should -- it's not until we link .o's to create a real |
31 |
executable that the system wants to make sure the executable code exists. |
32 |
|
33 |
The bit that makes me think I'm stupid is that it seems that neither gcc |
34 |
or I can find the source (.c) or compiled binaries (.o) which implement |
35 |
the structures and functions defined in ldap.h. What am I doing wrong? |
36 |
Where are the .c and .o files supposed to be on a regular linux system? |
37 |
Where on gentoo? Have I missed a crucial flag? |
38 |
|
39 |
Thanks in advance... |
40 |
|
41 |
-- |
42 |
gentoo-user@g.o mailing list |