C++ Library/Link Question
Douglas Jerome
plug-devel@lists.PLUG.phoenix.az.us
Thu Jul 12 07:55:13 2001
So, if this list is not apropriate for this sort of direct
question, let me know and I wont do it (anymore). But, I
have a question about linking together C++ code.
I compile several C++ files (f1.cc, f2.cc, and f3.cc) and
incrementally link them together:
ld -r -o lib.o f1.o f2.o f3.o
or
ar r lib.a f1.o f2.o f3.o
then I compile some other files (main.cc, p1.cc, and p2.cc)
with a main and link them together with lib.o from above:
g++ -o prog main.o p1.o p2.o lib.o
or
g++ -o prog main.o p1.o p2.o lib.a
It works fine for gcc, but doesn't work for g++; the
code in main.cc, p1.cc, and p2.cc that try to make objects
from the classes in lib.o can't find them. There are
unresolved references, as if I didn't have lib.o involved
at all.
Anyone know where I can find information on making and using
a library with C++?
Thanks.
--
Douglas Jerome <djerome@users.sourceforge.net>