home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / linux / 25079 < prev    next >
Encoding:
Text File  |  1993-01-22  |  9.8 KB  |  288 lines

  1. Path: sparky!uunet!nwnexus!remote!UUCP
  2. From: Paul.Caffrey@f15.n229.z1.fidonet.org (Paul Caffrey)
  3. Newsgroups: comp.os.linux
  4. Subject: Pt 1/2: linux 0.98 c++ st
  5. Message-ID: <727676295.AA34613@remote.halcyon.com>
  6. Date: Mon, 11 Jan 1993 13:43:11 -0800
  7. Sender: UUCP@remote.halcyon.com
  8. Lines: 278
  9.  
  10. Reply-To: pac30@DUTS.ccc.amdahl.com (Paul Caffrey)
  11.  
  12. PID: Fred 1.9n6
  13. Hi,
  14.  
  15. I can't get the c++ stream io implementation of the 0.98 linux SLS
  16. distribution
  17. working.
  18.  
  19. The following program(cout.c):
  20.  
  21. #include <iostream.h>
  22. main(){
  23. cout << "Hello World!\n";
  24. }
  25.  
  26. fails to compile (g++ cout.c) with the following message:
  27.  
  28.  
  29. cout.o: Undefined symbol _cout referenced from text segment
  30. cout.o: Undefined symbol operator<<(ostream &, const char *) referenced
  31. from
  32. text segment
  33.  
  34. Can anyone explain why this happens? All other c++ appear to be
  35. working.
  36. ps while I'm on is there a "dissambler" program for linux?
  37. Paul
  38. email pac30@amail.amdahl.com
  39.  
  40. ps the following is the file iostream.h
  41.  
  42. //    This is part of the iostream library, providing -*- C++ -*-
  43. input/output.
  44. //    Copyright (C) 1991 Per Bothner.
  45. //
  46. //    This library is free software; you can redistribute it and/or
  47. //    modify it under the terms of the GNU Library General Public
  48. //    License as published by the Free Software Foundation; either
  49. //    version 2 of the License, or (at your option) any later version.
  50. //
  51. //    This library is distributed in the hope that it will be useful,
  52. //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  53. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  54. //    Library General Public License for more details.
  55. //
  56. //    You should have received a copy of the GNU Library General Public
  57. //    License along with this library; if not, write to the Free
  58. //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
  59. USA.
  60.  
  61. #ifndef _IOSTREAM_H
  62. #ifdef __GNUG__
  63. #pragma interface
  64. #endif
  65. #define _IOSTREAM_H
  66. #define Q_ENV
  67.  
  68. #include <streambuf.h>
  69.  
  70. class istream; class ostream;
  71. typedef ios& (*__manip)(ios&);
  72. typedef istream& (*__imanip)(istream&);
  73. typedef ostream& (*__omanip)(ostream&);
  74.  
  75. extern istream& ws(istream& ins);
  76. extern ostream& flush(ostream& outs);
  77. extern ostream& endl(ostream& outs);
  78. extern ostream& ends(ostream& outs);
  79.  
  80. class ostream : public ios
  81. {
  82.     void do_osfx();
  83.   public:
  84.     ostream() { }
  85.     ostream(streambuf* sb, ostream* tied=NULL);
  86.     int opfx() { if (!good()) return 0; if (_tie) _tie->flush(); return
  87. 1; }
  88.     void osfx() { if (flags() & (ios::unitbuf|ios::stdio))
  89.       do_osfx(); }
  90.     streambuf* ostreambuf() const { return _strbuf; }
  91.     ostream& flush();
  92.     ostream& put(char c) { _strbuf->sputc(c); return *this; }
  93.  
  94.     ostream& write(const char *s, int n);
  95.     ostream& write(const unsigned char *s, int n) { return write((const
  96. char*)s, n);}
  97. #ifndef _G_BROKEN_SIGNED_CHAR
  98.     ostream& write(const signed char *s, int n) { return write((const
  99. char*)s,
  100. n);}
  101. #endif
  102.     ostream& write(const void *s, int n) { return write((const char*)s,
  103. n);}
  104.     ostream& seekp(streampos);
  105.     ostream& seekp(streamoff, _seek_dir);
  106.     streampos tellp();
  107.     ostream& form(const char *format ...);
  108.     ostream& vform(const char *format, _G_va_list args);
  109. };
  110.  
  111. extern ostream& operator<<(ostream&, char c);
  112. inline ostream& operator<<(ostream& os, unsigned char c)
  113. { return os << (char)c; }
  114. #ifndef _G_BROKEN_SIGNED_CHAR
  115. extern ostream& operator<<(ostream &os, signed char c) { return os <<
  116. (char)c;}
  117. #endif
  118. extern ostream& operator<<(ostream&, const char *s);
  119. inline ostream& operator<<(ostream& os, const unsigned char *s)
  120. { return os << (const char*)s; }
  121. #ifndef _G_BROKEN_SIGNED_CHAR
  122. inline ostream& operator<<(ostream& os, const signed char *s)
  123. { return os << (const char*)s; }
  124. #endif
  125. extern ostream& operator<<(ostream&, void *p);
  126. extern ostream& operator<<(ostream&, int n);
  127. extern ostream& operator<<(ostream&, long n);
  128. extern ostream& operator<<(ostream&, unsigned int n);
  129. extern ostream& operator<<(ostream&, unsigned long n);
  130. inline ostream& operator<<(ostream& os, short n) {return os << (int)n;}
  131. inline ostream& operator<<(ostream& os, unsigned short n)
  132. {return os << (unsigned int)n;}
  133. extern ostream& operator<<(ostream&, float n);
  134. extern ostream& operator<<(ostream&, double n);
  135. inline ostream& operator<<(ostream& os, __omanip func) { return
  136. (*func)(os); }
  137. inline ostream& operator<<(ostream& os, __manip func) {(*func)(os);
  138. return os;}
  139. extern ostream& operator<<(ostream&, streambuf*);
  140.  
  141. class istream : public ios
  142. {
  143.     _G_ssize_t _gcount;
  144.  
  145.     int _skip_ws();
  146.   public:
  147.     istream() { _gcount = 0; }
  148.     istream(streambuf* sb, ostream*tied=NULL);
  149.     streambuf* istreambuf() const { return _strbuf; }
  150.     istream& get(char& c);
  151.     istream& get(unsigned char& c) { return get((char&)c); }
  152. #ifndef _G_BROKEN_SIGNED_CHAR
  153.     istream& get(signed char& c)  { return get((char&)c); }
  154. #endif
  155.     istream& read(char *ptr, int n);
  156.     istream& read(unsigned char *ptr, int n) { return read((char*)ptr,
  157. n); }
  158. #ifndef _G_BROKEN_SIGNED_CHAR
  159.     istream& read(signed char *ptr, int n) { return read((char*)ptr, n);
  160. }
  161. #endif
  162.     istream& read(void *ptr, int n) { return read((char*)ptr, n); }
  163.     // Should get() and/or peek() set failbit and/or eofbit? FIXME!
  164.     istream& getline(char* ptr, int len, char delim = '\n');
  165.     istream& get(char* ptr, int len, char delim = '\n');
  166.     istream& get(streambuf& sb, char delim = '\n');
  167.     istream& gets(char **s, char delim = '\n');
  168.     int ipfx(int need) {
  169. if (!good()) { set(ios::failbit); return 0; }
  170. if (_tie && (need == 0 || rdbuf()->in_avail() < need)) _tie->flush();
  171. if (!need && (flags() & ios::skipws)) return _skip_ws();
  172. return 1;
  173.     }
  174.     int ipfx0() { // Optimized version of ipfx(0).
  175. if (!good()) { set(ios::failbit); return 0; }
  176. if (_tie) _tie->flush();
  177. if (flags() & ios::skipws) return _skip_ws();
  178. return 1;
  179.     }
  180.     int ipfx1() { // Optimized version of ipfx(1).
  181. if (!good()) { set(ios::failbit); return 0; }
  182. if (_tie && rdbuf()->in_avail() == 0) _tie->flush();
  183. return 1;
  184.     }
  185.     int get() { if (!ipfx1()) return EOF;
  186. int ch = _strbuf->sbumpc();
  187. if (ch == EOF) set(ios::eofbit);
  188. return ch; }
  189.     int peek() { if (!ipfx1()) return EOF;
  190. int ch = _strbuf->sgetc();
  191. if (ch == EOF) set(ios::eofbit);
  192. return ch; }
  193.     _G_ssize_t gcount() { return _gcount; }
  194.     istream& ignore(int n=1, int delim = EOF);
  195.     istream& seekg(streampos);
  196.     istream& seekg(streamoff, _seek_dir);
  197.     streampos tellg();
  198.     istream& putback(char ch) {
  199. if (good() && _strbuf->sputbackc(ch) == EOF) clear(ios::badbit);
  200. return *this;}
  201.     istream& unget() {
  202. if (good() && _strbuf->sungetc() == EOF) clear(ios::badbit);
  203. return *this;}
  204.     istream& scan(const char *format ...);
  205.     istream& vscan(const char *format, _G_va_list args);
  206. #ifdef _STREAM_COMPAT
  207.     istream& unget(char ch) { return putback(ch); }
  208.     int skip(int i);
  209. #endif
  210. };
  211.  
  212. extern istream& operator>>(istream&, char*);
  213. inline istream& operator>>(istream& is, unsigned char* p)
  214. { return is >> (char*)p; }
  215. #ifndef _G_BROKEN_SIGNED_CHAR
  216. inline istream& operator>>(istream& is, signed char*p) {return is >>
  217. (char*)p;}
  218. #endif
  219. extern istream& operator>>(istream&, char& c);
  220. extern istream& operator>>(istream& s, unsigned char& c) {return
  221. s>>(char&)c;}
  222. #ifndef _G_BROKEN_SIGNED_CHAR
  223. extern istream& operator>>(istream& s, signed char& c) {return s >>
  224. (char&)c;}
  225. #endif
  226. extern istream& operator>>(istream&, int&);
  227. extern istream& operator>>(istream&, long&);
  228. extern istream& operator>>(istream&, short&);
  229. extern istream& operator>>(istream&, unsigned int&);
  230. extern istream& operator>>(istream&, unsigned long&);
  231. extern istream& operator>>(istream&, unsigned short&);
  232. extern istream& operator>>(istream&, float&);
  233. extern istream& operator>>(istream&, double&);
  234. inline istream& operator>>(istream& is, __manip func) {(*func)(is);
  235. return is;}
  236. inline istream& operator>>(istream& is, __imanip func) { return
  237. (*func)(is); }
  238. extern istream& operator>>(istream&, streambuf*);
  239.  
  240. class iostream : public ios {
  241.     _G_ssize_t _gcount;
  242.   public:
  243.     iostream() { _gcount = 0; }
  244.     iostream(streambuf* sb, ostream*tied=NULL);
  245.     operator istream&() { return *(istream*)this; }
  246.     operator ostream&() { return *(ostream*)this; }
  247.     // NOTE: These duplicate istream methods.
  248.     istream& get(char& c) { return ((istream*)this)->get(c); }
  249.     istream& get(unsigned char& c) { return
  250. ((istream*)this)->get((char&)c); }
  251. #ifndef _G_BROKEN_SIGNED_CHAR
  252.     istream& get(signed char& c) { return
  253. ((istream*)this)->get((char&)c); }
  254. #endif
  255.     istream& read(char *ptr, int n) { return ((istream*)this)->read(ptr,
  256. n); }
  257.     istream& read(unsigned char *ptr, int n)
  258. { return ((istream*)this)->read((char*)ptr, n); }
  259. #ifndef _G_BROKEN_SIGNED_CHAR
  260.     istream& read(signed char *ptr, int n)
  261. { return ((istream*)this)->read((char*)ptr, n); }
  262. #endif
  263.     istream& read(void *ptr, int n)
  264. { return ((istream*)this)->read((char*)ptr, n); }
  265.     istream& getline(char* ptr, int len, char delim = '\n')
  266. { return ((istream*)this)->getline(ptr, len, delim); }
  267.     istream& get(char* ptr, int len, char delim = '\n')
  268. { return ((istream*)this)->get(ptr, len, delim); }
  269.     istream& gets(char **s, char delim = '\n')
  270. { return ((istream*)this)->gets(s, delim); }
  271.     istream& ignore(int n=1, int delim = EOF)
  272. { return ((istream*)this)->ignore(n, delim); }
  273.     int ipfx(int need) { return ((istream*)this)->ipfx(need); }
  274.     int ipfx0()  { return ((istream*)this)->ipfx0(); }
  275.     int ipfx1()  { return ((istream*)this)->ipfx1(); }
  276.     int get() { return _strbuf->sbumpc(); }
  277.     int peek() { return ipfx1() ? _strbuf->sgetc() : EOF; }
  278.     _G_ssize_t gcount() { return _gcount; }
  279.     istream& putback(char ch) { return ((istream*)this)->putback(ch); }
  280.     istream& unget() { return ((istream*)this)->unget(); }
  281.     istream& seekg(streampos pos) { return ((istream*)this)->seekg(pos);
  282. }
  283.     istream& seekg(streamoff off, _seek_dir dir)
  284. { return ((istream*)this)->seekg(off, dir); }
  285. <<MESSAGE TOO LONG -- SOME LINES WERE DELETED>>
  286.  * Origin: Canada Remote Systems, Mississauga, Ontario  (1:229/15)
  287.  
  288.