[5626] in testers
g++ and cout
daemon@ATHENA.MIT.EDU (Kevin Chen)
Tue Jul 8 09:43:54 2003
Date: Tue, 8 Jul 2003 09:43:50 -0400 (EDT)
From: Kevin Chen <kchen@MIT.EDU>
To: testers@MIT.EDU
Message-ID: <Pine.LNX.4.55L.0307080934550.444@cheshire-cat.mit.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Compiling the following program with the command line:
/usr/bin/g++ test.cpp -o test
fails on both Sun and Linux 9.2 machines, but works on both types of 9.1
machines.
#include <iostream>
int main() {
cout << "meep\n";
return 0;
}
The error message returned is:
test.cpp: In function `int main()':
test.cpp:4: `cout' undeclared (first use this function)
test.cpp:4: (Each undeclared identifier is reported only once for each
function
it appears in.)
The same program also fails on Linux 9.2, but works on 9.1 and Sun 9.1,
with the command line:
athrun gnu g++ test.cpp -o test
but gives the following error instead:
/mit/gnu/arch/i386_linux24/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/libstdc++.a(iostream.o):
In function `skip_ws(streambuf *)':
iostream.o(.text+0xc4): undefined reference to `__ctype_b'
/mit/gnu/arch/i386_linux24/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/libstdc++.a(iostream.o):
In function `istream::operator>>(char *)':
iostream.o(.text+0x787): undefined reference to `__ctype_b'
/usr/lib/libc_nonshared.a(elf-init.oS): In function `__libc_csu_init':
elf-init.oS(.text+0xb): undefined reference to `__init_array_end'
elf-init.oS(.text+0x10): undefined reference to `__init_array_start'
elf-init.oS(.text+0x23): undefined reference to `__init_array_start'
/usr/lib/libc_nonshared.a(elf-init.oS): In function `__libc_csu_fini':
elf-init.oS(.text+0x36): undefined reference to `__fini_array_end'
elf-init.oS(.text+0x3b): undefined reference to `__fini_array_start'
elf-init.oS(.text+0x57): undefined reference to `__fini_array_start'
collect2: ld returned 1 exit status
--
Kevin Chen
http://www.sneswhiz.com/