help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

separate implementation and head files, and make library, get trouble.


From: Jon Z. Xue
Subject: separate implementation and head files, and make library, get trouble.
Date: Wed, 10 Nov 2004 18:13:05 -0500

Hi, help --- what is going one after I make a library and tries to use this
library in the link stage? See the following two makefiles, the first one
doens work and the second one works fine.

best
jon

For the first one, here is the error message:

        g++ -o test -L./ -lxzimage test.o -lstdc++ -O2
ld32: WARNING 84: ./libxzimage.a is not used for resolving any symbol.
ld32: WARNING 84:
/usr/freeware/lib/gcc-lib/mips-sgi-irix6.5/3.2.1/libstdc++.a is not used for
resolving any symbol.
ld32: WARNING 84: /usr/lib32/libm.so is not used for resolving any symbol.
ld32: ERROR 33: Unresolved text symbol "CImage::CImage[in-charge](int, int,
int)" -- 1st referenced by test.o.
        Use linker option -v to see when and which objects, archives and
dsos are loaded.
ld32: ERROR 33: Unresolved text symbol "CImage::print_imageinfo()" -- 1st
referenced by test.o.
        Use linker option -v to see when and which objects, archives and
dsos are loaded.
ld32: ERROR 33: Unresolved text symbol "CImage::read()" -- 1st referenced by
test.o.
        Use linker option -v to see when and which objects, archives and
dsos are loaded.
ld32: ERROR 33: Unresolved text symbol "CImage::write()" -- 1st referenced
by test.o.
        Use linker option -v to see when and which objects, archives and
dsos are loaded.
ld32: ERROR 33: Unresolved text symbol "CImage::~CImage [in-charge]()" -- 
1st referenced by test.o.
        Use linker option -v to see when and which objects, archives and
dsos are loaded.
ld32: INFO 152: Output file removed because of error.
collect2: ld returned 2 exit status
*** Error code 1 (bu21)

*********************


makefile.lib:
---
all : test
test : libxzimage.a test.o
 g++ -o test -L./ -lxzimage test.o -lstdc++ -O2
test.o : test.cc
 g++ -c test.cc -I./ -fno-implicit-templates -Wall -O2
xzimage.o : xzimage.cc xzimage.h
 g++ -c xzimage.cc -I./ -fno-implicit-templates  -Wall -O2
libxzimage.a : xzimage.o
 ar -r libxzimage.a xzimage.o
clean :
 rm -rf *.o test
---

******************

makefile
-----
all : test
test : xzimage.o test.o
        g++ -o test -L./ xzimage.o test.o -lstdc++ -O2
test.o : test.cc
        g++ -c test.cc -I./ -fno-implicit-templates -Wall -O2
xzimage.o : xzimage.cc xzimage.h
        g++ -c xzimage.cc -I./ -fno-implicit-templates  -Wall -O2
libxzimage.a : xzimage.o
        ar -r libxzimage.a xzimage.o
clean :
        rm -rf *.o try
-----






reply via email to

[Prev in Thread] Current Thread [Next in Thread]