I have both version 4.0.1 and 4.2.2 of gcc installed in my computer just in case that matters. I'm trying to link a small test program to learn to use the linker, but the linker can't seem to find the library, even under the indication to look for it under the current directory.
I had already obtained similar errors in past ocassions, that is to say, the linker doesn't find any libs even when I think I'm indicating both the correct name and the path using the -l and -L flags, respectively.
I've read the man files for both gcc and for ld, and I still can't pinpoint the error. I would really appreciate if anyone could help me out.
Code:
*** here are the files in the folder I am linking in
[prompt]$ ls
app.c
app.o
linker_error
temp_file.c
temp_file.o
test.c
testlib.a
test.o
*** here is the line that I used to link and the error I got:
[prompt]$ gcc -o app app.o -L. -ltest
/usr/bin/ld: cannot find -ltest
collect2: ld returned 1 exit status