Re: Problems with GNU linker
On Wed, 2010-11-03, Victor Bazarov wrote:
...
My program compiles but does not link. I obtain this error:
**** Build of configuration Debug for project pmrplib ****
make all
Building target: pmrplib
Invoking: GCC C++ Linker
g++ -L/home/luca/Sviluppo/projects/pmrplib/fvlib/Debug -o"pmrplib" ./
cpmrplib.o ./cpmrp.o ./main.o -llibfvlib.a
/usr/bin/ld: cannot find -llibfvlib.a
Try putting that command line option *before* the first .o
file in your list.
Which command line option? Not the -l, certainly. (-l
specifies a library. And Unix linkers process libraries in the
order they see them, so libraries must be specified after the
object files.)
And just for the record (because the following comment is
correct), -lxyz causes libxyz.a or libxyz.so to be included;
unless he really has a library names liblibfvlib.a.a or
liblibfvlib.a.so, what he probably wants is -lfvlib.
And next time do ask in the newsgroup where this is on topic,
like 'gnu.gcc.help'.
Well, reading the manual would help for starters---there's
really no need for a newsgroup at all. (But if there is, then
a g++ group would be most appropriate.)
Or rather the group for whatever build system he uses. Eclipse?
The messages above seem to be part GNU make, and part something
horrible that's completely alien to me.
The error message is quite clearly from /usr/bin/ld. The Unix
linker, invoked indirectly by g++. (And while GNU make
certainly is horrible in some ways, there doesn't seem to be any
other game in town. At least, I've yet to find another build
tool that actually works.)
--
James Kanze