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

  1. Newsgroups: gnu.g++.lib.bug
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!wcuvax1.wcu.edu!BRAY
  3. From: BRAY@wcuvax1.wcu.edu (Jim Bray)
  4. Subject: Source filenames apparently affect symbol names
  5. Message-ID: <01GTA2WBPMGI8WW5CM@WCUVAX1.WCU.EDU>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Fri, 8 Jan 1993 09:42:54 GMT
  10. Approved: bug-lib-g++@prep.ai.mit.edu
  11. Lines: 43
  12.  
  13.   The simple test program, partially included below, results in
  14. multiply-defined symbols if compiled with the name "fstream.cxx", as
  15. g++ fstream.cxx.
  16.   It finally percolated thru my fossilized brainpan that the other
  17. source of the mul-defs was libg++/iostream/fstream.o, and it occured
  18. to me I should try compiling as
  19. g++ foo.cxx
  20. which compiles fine. The original fstream.cxx comes straight off of a
  21. source disk of test/example programs from a c++ textbook, and is
  22. believed to work with other c++ compilers. It was my belief that
  23. source filenames were not significant in C, and the professor who is
  24. teaching the c++ class believes that this should be the case in c++.
  25.   The output of nm verifies this behavior. Compiled as foo.cc, the
  26. only locally-defined symbol is main. Compiled as fstream.cc, what
  27. appear to be member functions of libg++ classes are defined locally.
  28.   I don't claim to know c++. Please be tolerant if this is a non-bug.
  29.  
  30. --Jim Bray (bray@wcuvax1.wcu.edu)
  31.  
  32. (Run Linux, the Official OS of the New World Order :))
  33. (Please Support the League for Programming Freedom, and Boycott ATT
  34.  because of their legal intimidation of BSDI, UCB, and CMU)
  35.  
  36.  
  37.  
  38. #include "fstream.h"
  39. #include "stdlib.h"
  40.  
  41. void main()
  42. {
  43. ifstream infile;
  44. ofstream outfile;
  45. ofstream printer;
  46. char filename[20];
  47.  
  48.    cout << "Enter the desired file to copy ----> ";
  49.  
  50.    cin >> filename;
  51.    infile.open(filename, ios::nocreate);
  52.    if (!infile) {
  53.       cout << "Input file cannot be opened.\n";
  54.       exit(1);
  55.  
  56.