This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
-frepo still not eork in 2.95.2
- To: gcc-bugs at gcc dot gnu dot org
- Subject: -frepo still not eork in 2.95.2
- From: Ruslan Shevchenko <rssh at roo dot kolo dot net>
- Date: Mon, 8 Nov 1999 09:32:01 -0800 (PST)
Content-Type: multipart/mixed;
boundary="------------B6CD2D7F9C017BCA3B138CCD"
This is a multi-part message in MIME format.
--------------B6CD2D7F9C017BCA3B138CCD
Content-Type: text/plain; charset=koi8-r
Content-Transfer-Encoding: 7bit
-f repo still not work in 2.95.2
Example is attached:
According for info documentation, after relinking of x1.cpp and x2.cpp
we can create library with all needed template instantiations.
on practice we have:
g++295 -I. -frepo -c x1.cpp
g++295 -I. -frepo -c x2.cpp
g++295 -I. -frepo x1.o x2.o | cat /dev/null
collect: recompiling x2.cpp
collect: recompiling x1.cpp
collect: relinking
/usr/lib/crt1.o: In function `_start':
/usr/lib/crt1.o(.text+0x49): undefined reference to `main'x1.o: In
function `_Deque_base<sptr<qqq>, allocator<sptr<qqq> >, 0>::_M_initiali
ze_map(unsigned int)':x1.o(.text+0x169): undefined reference to
`_Deque_base<sptr<qqq>, allocator<sptr
<qqq> >, 0>::_M_create_nodes(sptr<qqq> **, sptr<qqq> **)'x1.o: In
function `_Deque_base<sptr<qqq>, allocator<sptr<qqq> >, 0>::~_Deque_bas
e(void)':x1.o(.text+0x26b): undefined reference to
`_Deque_base<sptr<qqq>, allocator<sptr
<qqq> >, 0>::_M_destroy_nodes(sptr<qqq> **, sptr<qqq> **)'
x2.o: In function `G2<set<qqq, OBP, allocator<qqq> >
>::G2(int)':x2.o(.text+0xaf): undefined reference to `G2<set<qqq, OBP,
allocator<qqq> > >::G
X1 virtual table'
collect2: ld returned 1 exit status
relinking step must be failed
ar -cru libss.a x1.o x2.o
g++295 -I. -frepo -c xm.cpp
g++295 -I. -frepo -o xm xm.o -L. -lss
collect: recompiling xm.cpp
collect: relinking
xm.o: In function `_Deque_base<sptr<qqq>, allocator<sptr<qqq> >,
0>::_M_initiali
ze_map(unsigned int)':
xm.o(.text+0xc9): undefined reference to `_Deque_base<sptr<qqq>,
allocator<sptr<
qqq> >, 0>::_M_create_nodes(sptr<qqq> **, sptr<qqq> **)'
xm.o: In function `_Deque_base<sptr<qqq>, allocator<sptr<qqq> >,
0>::~_Deque_bas
e(void)':
xm.o(.text+0x1cb): undefined reference to `_Deque_base<sptr<qqq>,
allocator<sptr
<qqq> >, 0>::_M_destroy_nodes(sptr<qqq> **, sptr<qqq> **)'
./libss.a(x2.o): In function `G2<set<qqq, OBP, allocator<qqq> >
>::G2(int)':
x2.o(.text+0xaf): undefined reference to `G2<set<qqq, OBP,
allocator<qqq> > >::G
X1 virtual table'
collect2: ld returned 1 exit status
*** Error code 1
This is error.,
P.S.
kulshedra$g++295 -v
Reading specs from
/usr/local/lib/gcc-lib/i386-unknown-freebsd3.0/2.95.2/specs
gcc version 2.95.2 19991024 (release)
--------------B6CD2D7F9C017BCA3B138CCD
Content-Type: text/plain; charset=koi8-r; name="x1.cpp"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="x1.cpp"
#include <x1.h>
void GX1::put_qqq(qqq*x) { v.push_back(x); }
--------------B6CD2D7F9C017BCA3B138CCD
Content-Type: text/plain; charset=koi8-r; name="x1.h"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="x1.h"
#include <deque.h>
struct qqq { int x; };
template<class T>
class sptr
{
T* x;
public:
sptr() { x = NULL; }
sptr(T* ix) { x = new T(*ix); }
void set_copy(T*ix) { if (x) delete x; x=new T(*ix); }
void set_ptr(T*ix) { if (x) delete x; x=ix; }
T* copy() { assert(x!=NULL); return new T(x); }
T* ptr() { return x; }
operator T*() { return ptr(); }
~sptr() { if (x) delete x; }
};
class GX1
{
private:
deque<sptr<qqq> > v;
public:
GX1()
:v()
{}
void put_qqq(qqq* x);
virtual ~GX1() {}
};
--------------B6CD2D7F9C017BCA3B138CCD
Content-Type: text/plain; charset=koi8-r; name="x2.cpp"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="x2.cpp"
#include <x2.h>
#include <set.h>
Y* createY()
{
return new Y;
}
--------------B6CD2D7F9C017BCA3B138CCD
Content-Type: text/plain; charset=koi8-r; name="x2.h"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="x2.h"
#include <algo.h>
#include <x1.h>
#include <set.h>
class OBP: public binary_function<qqq,qqq,bool>
{
public:
bool operator()(qqq& x1, qqq& x2) { return (x2.x < x1.x); }
};
template<class X>
class G2: virtual public GX1
{
private:
X* t1;
public:
G2() : GX1() { t1 = new X; }
virtual ~G2() { delete t1; }
typename X::iterator find_if(OBP& x, qqq* x1)
{
return find_if(t1->begin(),t1->end(),bind1st(x,x1));
}
};
typedef G2<
set<
qqq,OBP
>
> Y;
Y* createY();
--------------B6CD2D7F9C017BCA3B138CCD
Content-Type: text/plain; charset=koi8-r; name="xm.cpp"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="xm.cpp"
#include <x2.h>
int main(void)
{
Y* y = createY();
return 0;
}
--------------B6CD2D7F9C017BCA3B138CCD
Content-Type: text/plain; charset=koi8-r; name="Makefile"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="Makefile"
CXX=g++295
CXXFLAGS=-I. -frepo
default: libss.a xm
libss.a: x1.o x2.o
$(CXX) $(CXXFLAGS) x1.o x2.o | cat /dev/null
ar -cru libss.a x1.o x2.o
xm: xm.o libss.a
$(CXX) $(CXXFLAGS) -o xm xm.o -L. -lss
x1.o: x1.cpp
$(CXX) $(CXXFLAGS) -c x1.cpp
x2.o: x2.cpp
$(CXX) $(CXXFLAGS) -c x2.cpp
xm.o: xm.cpp
$(CXX) $(CXXFLAGS) -c xm.cpp
--------------B6CD2D7F9C017BCA3B138CCD--