🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.os.linux.mandrake
Article #494

the phrases "undefined reference" and "in-charge"

#494
From: Novice
Date: Thu, 30 Oct 2003 18:09
128 lines
5305 bytes
I'm attempting to compile, link and then execute some C++ code I've
written - I've executed it in the past, but recently made some changes to it
on one platform and then ported it BACK over to Mandrake (i.e. I have
compiled, linked and executed the code previously on the same Mandrake
computer that I'm trying to do now) and attempted to re-compile and link on
the same Mandrake computer I had it running on before.  Unfortunately, I
can't get ride of the following linker errors:

TimSystem.o(.text+0x1bf): In function
`__static_initialization_and_destruction_0(int, int)':
: undefined reference to
`txl::io::BufferedOutputStream::BufferedOutputStream[in-charge]()'
collect2: ld returned 1 exit status

I've done some google'ing on the phrases:
"undefined reference" and "in-charge"

In most cases, it appears the user wasn't:
1. using g++ or
2. using the proper form for includes or
3. not using namespaces properly

However, I can't find these problems in my code (I've used the -Wall switch
to g++ and didn't receive anything useful other than the initilizer lists
are being rearranged to accomodate the ordering as they are declared).  The
one problem that does exist in my code is that there are still some member
functions (a minority) that I've left inline and that I'm thinking might
need to be put into the source file (.cpp).

Here is the TimSystem.h file:
-----------------------------------------
#ifndef TIM_SYSTEM_H__
#define TIM_SYSTEM_H__

#include "PrintStream.h"

class System;
typedef SmartPtr<System> SmtSystemPtr;

class System : public Object {
  public:
    static void arraycopy(SmtObjectPtr src,
                             int srcPos,
                             SmtObjectPtr dest,
                             int destPos,
                             int length);

    static txl::io::SmtPrintStreamPtr out;
};

#endif
-----------------------------------------
Here is the TimSystem.cpp file:
-----------------------------------------
#include "TimSystem.h"
#include "PrintStream.h"
#include "BufferedOutputStream.h"
#include "TimBasicTypes.h"

using namespace txl::io;

SmtPrintStreamPtr System::out = SmtPrintStreamPtr (new
PrintStream(SmtBufferedOutputStreamPtr (new
txl::io::BufferedOutputStream()), true));

    void System::arraycopy(SmtObjectPtr src,
                             int srcPos,
                             SmtObjectPtr dest,
                             int destPos,
                             int length){
      StdVector<SmtObjectPtr>::type srcStdVector =
src.Dynamic_cast((StdVector<SmtObjectPtr>::type *)0);
      StdVector<SmtObjectPtr>::type destStdVector =
dest.Dynamic_cast((StdVector<SmtObjectPtr>::type *)0);
      int indexToIterateToInDestVector = length + destPos;
      for (destPos; destPos < indexToIterateToInDestVector; destPos++){
        destStdVector[destPos] = srcStdVector[srcPos]->clone();
        srcPos++;
      }
    }

-----------------------------------------
Here is where the default constructor for txl::io::BufferedOutputStream is
declared:
-----------------------------------------
#ifndef BUFFERED_OUTPUT_STREAM_H__
#define BUFFERED_OUTPUT_STREAM_H__

#include "FilterOutputStream.h"

namespace txl {
    namespace io {
        class BufferedOutputStream;
        typedef SmartPtr <BufferedOutputStream> SmtBufferedOutputStreamPtr;
        class BufferedOutputStream : public FilterOutputStream {
          public:
            BufferedOutputStream ();
//more code follows
};
}
}

#endif
-----------------------------------------
Here is the definition of the default constructor from
txl::io::BufferedOutputStream
-----------------------------------------
            txl::io::BufferedOutputStream::BufferedOutputStream (){
            }
-----------------------------------------

Here is the way I'm compiling:
-----------------------------------------
g++ -DVERIFY -DNO_VERISOFT -c *.cpp
-----------------------------------------

No errors from the compilation.  Then here is the way I'm linking:
-----------------------------------------
g++ -DVERIFY -DNO_VERISOFT -o *.o
-----------------------------------------

I've also attempted ordering all of the .o files explicitly (i.e. not using
*.o) with no better results.

Any suggestions?

Thanks,
Novice
Technical Details
Message-ID: <bnrjs1$mmt$1@knot.queensu.ca>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!wn14feed!worldnet.att.net!207.35.177.252!nf3.bellglobal.com!snoopy.risq.qc.ca!torn!news.ccs.queensu.ca!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f8a83,c3065f741ba0d469,start
X-Google-Attributes: gidf8a83,public
X-Google-Thread: 10ba33,c3065f741ba0d469,start
X-Google-Attributes: gid10ba33,public
X-Google-ArrivalTime: 2003-10-30 10:10:05 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!wn14feed!worldnet.att.net!207.35.177.252!nf3.bellglobal.com!snoopy.risq.qc.ca!torn!news.ccs.queensu.ca!not-for-mail
From: "Novice" <cassidy@cs.queensuDOTca>
Newsgroups: alt.os.linux.mandrake,gnu.g++.help
Subject: the phrases "undefined reference" and "in-charge"
Date: Thu, 30 Oct 2003 13:09:02 -0500
Organization: Queen's University, Kingston
Lines: 131
Message-ID: <bnrjs1$mmt$1@knot.queensu.ca>
NNTP-Posting-Host: polka.cs.queensu.ca
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165