home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / gnu / g / lib / bug / 757 < prev    next >
Encoding:
Text File  |  1993-01-08  |  4.1 KB  |  132 lines

  1. Newsgroups: gnu.g++.lib.bug
  2. Path: sparky!uunet!cs.utexas.edu!sun-barr!ames!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!wcuvax1.wcu.edu!BRAY
  3. From: BRAY@wcuvax1.wcu.edu (Jim Bray)
  4. Subject: (libg++2.3/g++2.3.3)Possible bug involving fstream.[Ch]
  5. Message-ID: <01GT8ZO5HRF68WW2WB@WCUVAX1.WCU.EDU>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Thu, 7 Jan 1993 15:00:00 GMT
  10. Approved: bug-lib-g++@prep.ai.mit.edu
  11. Lines: 119
  12.  
  13.   The program included at the end of this message, which is supposed
  14. to be a simple test program, compiles as follows:
  15.  
  16. #g++ fstream.cxx
  17. fstream.cxx:8: warning: return type for `main' changed to integer type
  18. ld: /usr/local/lib/libg++.a(fstream.o): fatal error: symbol
  19. `rdbuf__C11fstreambase` multiply-defined, also in file
  20. /usr/tmp/cca000Fj1.o
  21.  
  22.   An nm of fstream.o produced in this dir shows:
  23. [7]     |         0|      36|FUNC |GLOB |0    |2      |rdbuf__C11fstreambase
  24.   An nm of /usr/local/libg++/libg++/iostream/fstream.o shows:
  25. [6]     |         0|      14|FUNC |GLOB |0    |2      |rdbuf__C11fstreambase
  26.  
  27.   I don't know c++, but my examination of
  28. /usr/..../iostream/fstream.[Ch] showed nothing obvious to me.
  29.   I looked at libg++/README and the g++ manpage. We do not have gld on
  30. this system; presumabely the -fno-gnu-binutils flag is set by default.
  31. I looked thru gcc-2.3.3 for collect, as referenced in the g++ manpage:
  32. there is a collect2.c in gcc, but no evidence that gcc ever made or
  33. installed a collect or ld.
  34.   I think perhaps either the g++ manpage is wrong for this system, or
  35. gcc/configure is failing to set the makefile up to install a necessary
  36. binary, or I should just shut up and try to install the thing. I am
  37. hesitant to do the latter while not knowing what is going on. Also, I
  38. suspect that libg++ could not have built at all with a wrong loader.
  39.   I apologise if this is some obvious thing I should know or be doing.
  40. I don't claim to know c++: I'm just trying to get this working.
  41.  
  42.   I tried libg++/make check. When tried from libg++, it fails with
  43. "arg list too long". When tried from libg++/libg++, it tries to make
  44. iostream/test:
  45. cd test; make check ...
  46. gcc -g -O -nostdinc++ -I. -I../.. -I./.. -I./../stdio
  47. -I./../../g++-include  -c tFile.C
  48. gcc -o tFile tFile.o ../libio.a ../../libg++.a
  49. Undefined                       first referenced
  50.  symbol                             in file
  51. .L_E2513                            tFile.o
  52. .L_E2514                            tFile.o
  53. .L_E2515                            tFile.o
  54. .L_E210                             tFile.o
  55. .L_E211                             tFile.o
  56.   The -g makes multiple labels-bug seems alive and well.
  57.  
  58. --Jim Bray (bray@wcuvax1.wcu.edu)
  59.  
  60. (Run Linux, the Official OS of the New World Order :))
  61. (Please Support the League for Programming Freedom, and Boycott ATT
  62.  because of their legal intimidation of BSDI, UCB, and CMU)
  63.  
  64.  
  65.  
  66. elentari:/usr/dbt/cpp_tutor/source/work[1]#cat fstream.cxx
  67.                                            // Chapter 1 - Program 4
  68. //#include "iostream.h"
  69. #include "fstream.h"
  70. //#include "process.h"  // did he screw up? or is he working with old
  71. version?
  72. #include "stdlib.h"
  73.  
  74. void main()
  75. {
  76. ifstream infile;
  77. ofstream outfile;
  78. ofstream printer;
  79. char filename[20];
  80.  
  81.    cout << "Enter the desired file to copy ----> ";
  82.  
  83.    cin >> filename;
  84.  
  85.    infile.open(filename, ios::nocreate);
  86.    if (!infile) {
  87.       cout << "Input file cannot be opened.\n";
  88.       exit(1);
  89.    }
  90.  
  91.    outfile.open("copy");
  92.    if (!outfile) {
  93.       cout << "Output file cannot be opened.\n";
  94.       exit(1);
  95.    }
  96.  
  97.    printer.open("PRN");
  98.    if (!printer) {
  99.       cout << "There is a problem with the printer.\n";
  100.       exit(1);
  101.    }
  102.  
  103.    cout << "All three files have been opened.\n";
  104.  
  105. char one_char;
  106.  
  107.    printer << "This is the beginning of the printed copy.\n\n";
  108.  
  109.    while (infile.get(one_char)) {
  110.       outfile.put(one_char);
  111.       printer.put(one_char);
  112.    }
  113.  
  114.  
  115.  
  116.  
  117.    printer << "\n\nThis is the end of the printed copy.\n";
  118.  
  119.    infile.close();
  120.    outfile.close();
  121.    printer.close();
  122.  
  123. }
  124.  
  125.  
  126.  
  127. // Result of execution
  128. //
  129. // (The input file is copied to the file named "COPY")
  130. // (The input file is printed on the printer
  131.  
  132.