* HELP! Why doesn't cxx compile this, when all others do?
@ 1996-04-30 4:00 Tom Bech
0 siblings, 0 replies; only message in thread
From: Tom Bech @ 1996-04-30 4:00 UTC (permalink / raw)
Hi,
I've tried compiling the very simple program "test.C" (see source
listing below) resulting in this:
> uname -a
OSF1 svartbak V3.0 347 alpha
> cxx -c -O -I. test.C
> cxx -o test test.o
ld:
Unresolved:
__dt__19listnode__T7intnodeXv
__ct__15list__T7intnodeXv
__dt__15list__T7intnodeXv
>
The cxx compiler is the only one I've run into that doesn't want
to compile/link this. It works fine with gcc(c++) 2.7.2 and also
with SGI's Delta c++ compiler running IRIX 5.3. I've also tried
it on Solaris and SunOS. Can any of you DEC people explain what
happens?
Using gcc 2.7.2:
> uname -a
OSF1 svartbak V3.0 347 alpha
> c++ -c -O -I. test.C
> c++ -o test test.o
> test
This program does nothing; cxx won't have it
>
And on a SGI:
> uname -a
IRIX gullregn 5.3 11091810 IP17 mips
> CC -c -O -I. test.C
> CC -o test test.o
C++ prelinker: executing: /usr/bin/NCC -c -O -I. test.C -o32
> test
This program does nothing; cxx won't have it
>
Thanks in advance
Tom
ps: The program is just an general example of the problem
---------------------------------
Msc. Section. Dep. of Informatics
Univ. of Bergen, Norway
---------------------------------
------------------------- Test.C --------------------------
#include <stdlib.h>
#include <iostream.h>
#include "IntList.H"
void main(void)
{
intlist *list= new intlist;
cout << "This program does nothing; cxx won't have it\n";
delete list;
}
------------------------- IntList.H -------------------------
#ifndef INTLISTH
#define INTLISTH
#include "MyList.H"
class intnode : public listnode<intnode> {
protected:
int i;
public:
int Get_i(void) { return(i); }
};
class intlist : public list<intnode> {
protected:
// Empty
public:
// Empty
};
#endif
--------------------------- MyList.H ------------------------------
#ifndef MYLISTH
#define MYLISTH
template <class nodetype>
class listnode {
protected:
long int index;
nodetype *next;
nodetype *prev;
public:
listnode();
virtual ~listnode();
nodetype *Next(void) { return(next); }
nodetype *Prev(void) { return(prev); }
};
template <class nodetype>
class list {
protected:
nodetype *head; // head of list
nodetype *tail; // tail of list
nodetype *current; // current element
long int num; // number of elements in list
public:
list();
virtual ~list();
};
template <class nodetype>
listnode<nodetype>::~listnode(void)
{
// Empty
}
template <class nodetype>
listnode<nodetype>::listnode(void)
{
next=NULL; prev=NULL; index=0;
}
template <class nodetype>
list<nodetype>::list(void)
{
num=0; head=NULL; tail=NULL; current=NULL;
}
template <class nodetype>
list<nodetype>::~list(void)
{
// Empty
}
#endif
----------------------------- EOF ----------------------------------
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1996-04-30 4:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-04-30 4:00 HELP! Why doesn't cxx compile this, when all others do? Tom Bech
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox