G
Georg
Hello,
I must be doing something wrong, but I don't get it:
- compile
gcc -c -O -Iinc src/hello.c -o obj/hello.o
gcc -c -O -Iinc src/msg_1.c -o obj/msg_1.o
gcc -c -O -Iinc src/msg_2.c -o obj/msg_2.o
- make library
ar -cru lib/libhello.a obj/msg_1.o obj/msg_2.o
ranlib lib/libhello.a
- link
ld -o exe/hello.x -t -Llib -lhello -lc obj/hello.o
ld: mode elf_i386
/lib/libc.so.6
obj/hello.o
?Why is ./lib/libhello.a missing here?
ld: warning: cannot find entry symbol start; defaulting to 0000000008048184
?What does that mean? How can I prevent it?
obj/hello.o(.text+0x17): In function `main':
: undefined reference to `msg_1'
obj/hello.o(.text+0x1c): In function `main':
: undefined reference to `msg_2'
ld: link errors found, deleting executable `exe/hello.x'
Check ./lib/libhello.a:
nm -s lib/libhello.a
Archive index:
msg_1 in msg_1.o
msg_2 in msg_2.o
msg_1.o:
00000000 T msg_1
U puts
msg_2.o:
00000000 T msg_2
U puts
There functions are in the archive. So why does the linker not find them?
Does anyone see my mistake?
I am working with SuSE Linux.
Bye,
Georg
I must be doing something wrong, but I don't get it:
- compile
gcc -c -O -Iinc src/hello.c -o obj/hello.o
gcc -c -O -Iinc src/msg_1.c -o obj/msg_1.o
gcc -c -O -Iinc src/msg_2.c -o obj/msg_2.o
- make library
ar -cru lib/libhello.a obj/msg_1.o obj/msg_2.o
ranlib lib/libhello.a
- link
ld -o exe/hello.x -t -Llib -lhello -lc obj/hello.o
ld: mode elf_i386
/lib/libc.so.6
obj/hello.o
?Why is ./lib/libhello.a missing here?
ld: warning: cannot find entry symbol start; defaulting to 0000000008048184
?What does that mean? How can I prevent it?
obj/hello.o(.text+0x17): In function `main':
: undefined reference to `msg_1'
obj/hello.o(.text+0x1c): In function `main':
: undefined reference to `msg_2'
ld: link errors found, deleting executable `exe/hello.x'
Check ./lib/libhello.a:
nm -s lib/libhello.a
Archive index:
msg_1 in msg_1.o
msg_2 in msg_2.o
msg_1.o:
00000000 T msg_1
U puts
msg_2.o:
00000000 T msg_2
U puts
There functions are in the archive. So why does the linker not find them?
Does anyone see my mistake?
I am working with SuSE Linux.
Bye,
Georg