From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,465507a2850dba0d,start X-Google-Attributes: gidfee84,public From: fuhrmann@weyl.wias-berlin.de (Juergen Fuhrmann) Subject: g++ 2.6.2 code not linked Date: 1995/11/08 Message-ID: #1/1 X-Deja-AN: 119005017 distribution: world organization: Technical University Berlin, Germany newsgroups: comp.unix.osf.osf1 There seems to be a problem with g++-2.6.2 on Digital Unix. I don't know if it is gone with 2.7.0 (I'm waiting for 2.7.1). Some programs which use more of iostream.h than simply 'cout <<...' do not link successfully. An example is attached below. I suppose it's a problem with ld not understanding symbols with "..ng" at the end. Juergen Juergen Fuhrmann fuhrmann@wias-berlin.de Weierstrass Institute for Applied Analysis and Stochastics (WIAS) Mohrenstrasse 39 D-10117 Berlin, Germany phone: (49) 030 20377 560 fax: (49) 030 2044975 ///////////////////////////////// #include #include #include // // This program does compile, link and run successfully on // SunOS 4.1.2 1 sun4m g++ 2.6.2 // IRIX 5.3 IP17 mips g++ 2.6.2 // IRIX 5.3 IP17 mips Edison Design Group C/C++ Front End, version 2.19 // OSF1 V3.2 148 alpha DEC C++ V5.0-3 for DEC OSF/1 (Alpha) // // It generates the following error with // // OSF1 V3.2 148 alpha g++ 2.6.2 // // ld: // [...] // Unresolved: // __3iosP9streambufP7ostream..ng // _$_7ostream..ng // [...] // These symbols are definitely in libg++.a (checked with nm). // // I did not find any workaround. static ostream *prt=0; static ostream *out=&cout; static ostream *err=&cerr; #define PREFIXLEN 15 class dbgstreambuf : public streambuf { private: int doprefix; public: char name[16]; char prefix[PREFIXLEN+2]; int is_on; dbgstreambuf(char *xname=0, int initial_state=1); int overflow(int ch); void off() { is_on=0; } void on() { is_on=1; } }; dbgstreambuf::dbgstreambuf(char *xname,int initial_state) : streambuf() { if (xname!=0) { int i,p0; strcpy(name,xname); p0=PREFIXLEN-strlen(name); if (p0<0) *err << "Warning: debug flag name " << xname << " too long!\n"; for (i=0;iflush(); } if (prt) { *prt << '\n'; prt->flush(); } if (*name!='\0') doprefix=1; } else { if (out) *out << (char)c; if (prt) *prt<<(char)c; } return 0; } /////////////////////////////////////////////////// class dbgstream : public dbgstreambuf, public ostream { public: dbgstream(char *name, int initial_state ) : dbgstreambuf(name,initial_state ), ostream(this) { }; operator void*(){ return (void*) is_on;} int operator!() { return !is_on; } }; static dbgstream tstr("test",1); void main(void) { tstr << "hello world\n" << " das ist der test\n"; tstr.off(); if (tstr) tstr << sizeof(tstr) << '\n'; } -- Juergen Fuhrmann fuhrmann@wias-berlin.de Weierstrass Institute for Applied Analysis and Stochastics (WIAS) Mohrenstrasse 39 D-10117 Berlin, Germany phone: (49) 030 20377 560 fax: (49) 030 2044975 * Bad News is No News *