08-29-05 11:00 PM
"milkyway" <d0mufasa@hotmail.com> writes:
> I then tried to compile test_query.c as follows:
No, you didn't *compile* test_query.c with that command.
Presumably you have already compiled it, and now you are *linking*
test_query.o
> gcc -I/demo/ test_query test_query.o -L/demo/ -ltest.a
>
> I get the following error:
> /usr/bin/ld: cannot find -l/demo/test.a
That's expected. Correct link command is:
gcc -o test_query test_query.o -L/demo -ltest
^^ ^^
> I guess I do not understand why this does not work. I have specified
> the entire path to the library but it continues to say that it never
> finds it.
>
> What's wrong?
From 'info ld':
`-lARCHIVE'
`--library=ARCHIVE'
Add archive file ARCHIVE to the list of files to link. This
option may be used any number of times. `ld' will search its
path-list for occurrences of `libARCHIVE.a' for every ARCHIVE
specified.
Note that the linker automatically adds 'lib' prefix and '.a' suffix.
Your original command asked linker to find libtest.a.a, which
(apparently) does not exist on your system.
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
[ Post a follow-up to this message ]
|