Thread View: gnu.g++.lib.bug
1 messages
1 total messages
Started by Jim Bray
Fri, 08 Jan 1993 09:42
Source filenames apparently affect symbol names
Author: Jim Bray
Date: Fri, 08 Jan 1993 09:42
Date: Fri, 08 Jan 1993 09:42
42 lines
1957 bytes
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);
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads