Thread View: gnu.g++.lib.bug
1 messages
1 total messages
Started by Jim Bray
Thu, 07 Jan 1993 15:00
(libg++2.3/g++2.3.3)Possible bug involving fstream.[Ch]
Author: Jim Bray
Date: Thu, 07 Jan 1993 15:00
Date: Thu, 07 Jan 1993 15:00
118 lines
4302 bytes
4302 bytes
The program included at the end of this message, which is supposed
to be a simple test program, compiles as follows:
#g++ fstream.cxx
fstream.cxx:8: warning: return type for `main' changed to integer type
ld: /usr/local/lib/libg++.a(fstream.o): fatal error: symbol
`rdbuf__C11fstreambase` multiply-defined, also in file
/usr/tmp/cca000Fj1.o
An nm of fstream.o produced in this dir shows:
[7] | 0| 36|FUNC |GLOB |0 |2 |rdbuf__C11fstreambase
An nm of /usr/local/libg++/libg++/iostream/fstream.o shows:
[6] | 0| 14|FUNC |GLOB |0 |2 |rdbuf__C11fstreambase
I don't know c++, but my examination of
/usr/..../iostream/fstream.[Ch] showed nothing obvious to me.
I looked at libg++/README and the g++ manpage. We do not have gld on
this system; presumabely the -fno-gnu-binutils flag is set by default.
I looked thru gcc-2.3.3 for collect, as referenced in the g++ manpage:
there is a collect2.c in gcc, but no evidence that gcc ever made or
installed a collect or ld.
I think perhaps either the g++ manpage is wrong for this system, or
gcc/configure is failing to set the makefile up to install a necessary
binary, or I should just shut up and try to install the thing. I am
hesitant to do the latter while not knowing what is going on. Also, I
suspect that libg++ could not have built at all with a wrong loader.
I apologise if this is some obvious thing I should know or be doing.
I don't claim to know c++: I'm just trying to get this working.
I tried libg++/make check. When tried from libg++, it fails with
"arg list too long". When tried from libg++/libg++, it tries to make
iostream/test:
cd test; make check ...
gcc -g -O -nostdinc++ -I. -I../.. -I./.. -I./../stdio
-I./../../g++-include -c tFile.C
gcc -o tFile tFile.o ../libio.a ../../libg++.a
Undefined first referenced
symbol in file
.L_E2513 tFile.o
.L_E2514 tFile.o
.L_E2515 tFile.o
.L_E210 tFile.o
.L_E211 tFile.o
The -g makes multiple labels-bug seems alive and well.
--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)
elentari:/usr/dbt/cpp_tutor/source/work[1]#cat fstream.cxx
// Chapter 1 - Program 4
//#include "iostream.h"
#include "fstream.h"
//#include "process.h" // did he screw up? or is he working with old
version?
#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);
}
outfile.open("copy");
if (!outfile) {
cout << "Output file cannot be opened.\n";
exit(1);
}
printer.open("PRN");
if (!printer) {
cout << "There is a problem with the printer.\n";
exit(1);
}
cout << "All three files have been opened.\n";
char one_char;
printer << "This is the beginning of the printed copy.\n\n";
while (infile.get(one_char)) {
outfile.put(one_char);
printer.put(one_char);
}
printer << "\n\nThis is the end of the printed copy.\n";
infile.close();
outfile.close();
printer.close();
}
// Result of execution
//
// (The input file is copied to the file named "COPY")
// (The input file is printed on the printer
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