🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.lib.bug
Article #438

Source filenames apparently affect symbol names

#438
From: Jim Bray
Date: Fri, 08 Jan 1993 09:42
42 lines
1957 bytes
  The simple test program, partially included below, results in
multiply-defined symbols if compiled with the name "fstream.cxx", as
g++ fstream.cxx.
  It finally percolated thru my fossilized brainpan that the other
source of the mul-defs was libg++/iostream/fstream.o, and it occured
to me I should try compiling as
g++ foo.cxx
which compiles fine. The original fstream.cxx comes straight off of a
source disk of test/example programs from a c++ textbook, and is
believed to work with other c++ compilers. It was my belief that
source filenames were not significant in C, and the professor who is
teaching the c++ class believes that this should be the case in c++.
  The output of nm verifies this behavior. Compiled as foo.cc, the
only locally-defined symbol is main. Compiled as fstream.cc, what
appear to be member functions of libg++ classes are defined locally.
  I don't claim to know c++. Please be tolerant if this is a non-bug.

--Jim Bray (bray@wcuvax1.wcu.edu)

(Run Linux, the Official OS of the New World Order :))
(Please Support the League for Programming Freedom, and Boycott ATT
 because of their legal intimidation of BSDI, UCB, and CMU)



#include "fstream.h"
#include "stdlib.h"

void main()
{
ifstream infile;
ofstream outfile;
ofstream printer;
char filename[20];

   cout << "Enter the desired file to copy ----> ";

   cin >> filename;
   infile.open(filename, ios::nocreate);
   if (!infile) {
      cout << "Input file cannot be opened.\n";
      exit(1);
Technical Details
Message-ID: <01GTA2WBPMGI8WW5CM@WCUVAX1.WCU.EDU>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!wcuvax1.wcu.edu!BRAY

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.lib.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!wcuvax1.wcu.edu!BRAY
From: BRAY@wcuvax1.wcu.edu (Jim Bray)
Subject: Source filenames apparently affect symbol names
Message-ID: <01GTA2WBPMGI8WW5CM@WCUVAX1.WCU.EDU>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Fri, 8 Jan 1993 09:42:54 GMT
Approved: bug-lib-g++@prep.ai.mit.edu
Lines: 43