From: madavis@igc.apc.org (Marilyn Davis)
Subject: memmove & seekg/streampos trouble
Organization: GNUs Not Usenet
Distribution: gnu
Date: Sat, 2 Jan 1993 23:13:47 GMT

Dear g++ experts,

I am trying to port my application from Liant C++ to GNU g++.  It 
almost works except for two error messages from the linker:

undefined			first referenced
 symbol  			    in file
seekp__8iostreamlQ243ios8seek_dir   /usr/tmp/cca141441.o
memmove                             /usr/local/lib/libg++.a

I have pared things down to a little tiny program that gives the
same results.  It is at the end of this file.

I am running on an Everex Step 386 with Interactive Unix System V.

The command I give for the compile:

g++ -o test -v /usr/local/lib/gcc-lib/i386-sco3.2v4/2.3.2/atexit.o test.cxx

The /usr/.../atexit.o file is a hack for the Interactive system because
it doesn't have an atexit function.

The output from the compile:

Reading specs from /usr/local/lib/gcc-lib/i386-sco3.2v4/2.3.2/specs
gcc version 2.3.2
 /usr/local/lib/gcc-lib/i386-sco3.2v4/2.3.2/cpp -lang-c++ -v -undef
 -D__GNUC__=2 -D__GUUG__=2 DD__cpusllus -D__i386 -D_M_I386-D_M_I86
 -D_M_I86SM -D_M_SDATA -D_M_STEXT -D__unix -D_M_UNIX -D_M_XENIX
 -D_M_SYS5 -D_M_SYSV -D_M_SYSV -D_M_SYS3 -D_M_SYSIII -D_M_COFF
 -D_M_BITFIELDS -D_M_WORDSWAP -Di386 -DM_I386 -DM_I86 -DM_I86SM
 -DM_SDATA -DM_STEXT -Dunix -DM_UNIX -DM_XENIX -DM_SYS5 -DM_SYSV
 -D_M_SYSV -DM_SYS3 -DM_SYSIII -DM_COFF -DM_BITFIELDS -DM_WORDSWAP
 test.cxx /usr/tmp/cca14144.i
GNU CPP version 2.3.2 (80386, ATT syntax)
 /usr/local/lib/gcc-lib/i386-sco3.2v4/2.3.2/cc1plus /usr/tmp/cca14144.i
 -quiet -dumpbase test.cc -version -o /usr/tmp/cca14144.s
GNU C++ version 2.3.2 (80386, ATT syntax) compiled by GNU C version 2.3.2.
 as -o /usr/tmp/cca141441.o /usr/tmp/cca14144.s
 ld -o test /lib/crt1.o /usr/local/lib/gcc-lib/i386-sco3.2v4/2.3.2/crtbegin.o
 -L/usr/local/lib/gcc-lib/i386-sco3.2v4/2.3.2 -L/usr/local/lib
 /usr/local/lib/gcc-lib/i386-sco3.2v4/2.3.2/atexit.o /usr/tmp/cca141441.o
 -lg++ -lgcc -lc -lgcc /usr/lccal/lib/gcc-lib/i386-sco3.2v4/2.3.2/crtend.o
 /lib/crtn.o
undefined			first referenced
 symbol  			    in file
seekp__8iostreamlQ243ios8seek_dir   /usr/tmp/cca141441.o
memmove                             /usr/local/lib/libg++.a
ld fatal: Symbol referencing errors. No output written to test
--------------------------------------------
That's all the info I can think to include.  Please write me if
you have any questions or answers.

Thank you in advance.

Marilyn Davis
Frontier Systems
madavis@igc.org
(415) 493-3631

p.s. Here comes the test program:  test.cxx .

------------------------------------------------------------

extern "C" {
#include <fcntl.h>
}
#include <iostream.h>
#include <fstream.h>
//  ***************************************************
//  
//   One class only, Conf
//
class Conf
  {
    public:
      Conf();
      void close_info();
      fstream& open_info(int mode = ios::app);
    private:
      streampos _end_offset;
      fstream _info_file;
      char _info_fname[20];
  };

Conf::Conf()
  {
    strcpy(_info_fname,"test.file");
  }

void Conf::close_info()
  {
    (ios&)_info_file.seekp((streamoff)0,ios::end);
    _end_offset = _info_file.tellp();
    _info_file.close();
  }											

fstream& Conf::open_info(int mode)
  {
    _info_file.open(_info_fname,mode);
    return _info_file;
  }			

//  *******************************************
//
//   And the main() - pretty simple
//
				
int main()
  {
    Conf * the_conf = new Conf;

    ostream& strm = (ostream&)the_conf->open_info();
    strm << 'x';
    the_conf->close_info();		
    delete the_conf;
    return 1;
  }