public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* gcc doesn't know <iostream> ?!
@ 2004-04-12 22:05 Christine Tobler
  2004-04-12 22:20 ` llewelly
  0 siblings, 1 reply; 2+ messages in thread
From: Christine Tobler @ 2004-04-12 22:05 UTC (permalink / raw)
  To: gcc-help

Hello,

I'm not sure this is the right address but I just can't get gcc to compile
any program using <iostream>, I tried everything I can think of.

When I try to compile just this:

#include <iostream>
using namespace std;

int main()
{
	//nothing in here!
}

it returns:

gcc -g -Wall -o hello.exe hello.cc
C:\WINDOWS\TEMP/cc2c06fb.o: In function
`Z41__static_initialization_and_destruction_0ii':
C:/PROGRA~1/MINGW/include/c++/3.2/iostream:62: undefined reference to
`std::ios_base::Init::Init()'
C:/PROGRA~1/MINGW/include/c++/3.2/iostream:62: undefined reference to
`std::ios_base::Init::~Init()'
C:\WINDOWS\TEMP/cc2c06fb.o: In function `main':
C:/Eigene Dateien/Tis/cpp/hello.cc:5: undefined reference to
`__gxx_personality_v0'

Compilation finished at Mon Apr 12 23:24:15

I'd be VERY happy if you could help me, I've been trying to get this working
for hours.

Christine Tobler



PS: Here's all the system info I could think of as might be useful:

I got gcc with MinGW32 2.0.0.3, when I do gcc -v there appears:

C:\WINDOWS>gcc -v
Reading specs from C:/PROGRA~1/MINGW/BIN/../lib/gcc-lib/mingw32/3.2/specs
Configured with:
../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host=
mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --en
able
-languages=f77,c++,objc,ada --disable-win32-registry --disable-shared
Thread model: win32
gcc version 3.2 (mingw special 20020817-1)

and with ld -v:

C:\WINDOWS>ld -v
GNU ld version 2.13

I got this error on two computers, one with Windows 98 and one with Windows
XP.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: gcc doesn't know <iostream> ?!
  2004-04-12 22:05 gcc doesn't know <iostream> ?! Christine Tobler
@ 2004-04-12 22:20 ` llewelly
  0 siblings, 0 replies; 2+ messages in thread
From: llewelly @ 2004-04-12 22:20 UTC (permalink / raw)
  To: Christine Tobler; +Cc: gcc-help

"Christine Tobler" <christine.tobler@gmx.ch> writes:

> Hello,
> 
> I'm not sure this is the right address but I just can't get gcc to compile
> any program using <iostream>, I tried everything I can think of.
> 
> When I try to compile just this:
> 
> #include <iostream>
> using namespace std;
> 
> int main()
> {
> 	//nothing in here!
> }
> 
> it returns:
> 
> gcc -g -Wall -o hello.exe hello.cc

You need:

g++ -g -Wall -o hello.exe hello.cc

C++ code must be linked using 'g++', *not* 'gcc' . 'gcc' only links
    with the C runtime and libraries, it does not link in the C++
    libraries. 

> C:\WINDOWS\TEMP/cc2c06fb.o: In function
> `Z41__static_initialization_and_destruction_0ii':
> C:/PROGRA~1/MINGW/include/c++/3.2/iostream:62: undefined reference to
> `std::ios_base::Init::Init()'
> C:/PROGRA~1/MINGW/include/c++/3.2/iostream:62: undefined reference to
> `std::ios_base::Init::~Init()'
> C:\WINDOWS\TEMP/cc2c06fb.o: In function `main':
> C:/Eigene Dateien/Tis/cpp/hello.cc:5: undefined reference to
> `__gxx_personality_v0'
> 
> Compilation finished at Mon Apr 12 23:24:15
> 
> I'd be VERY happy if you could help me, I've been trying to get this working
> for hours.
> 
> Christine Tobler
> 
> 
> 
> PS: Here's all the system info I could think of as might be useful:
> 
> I got gcc with MinGW32 2.0.0.3, when I do gcc -v there appears:
> 
> C:\WINDOWS>gcc -v
> Reading specs from C:/PROGRA~1/MINGW/BIN/../lib/gcc-lib/mingw32/3.2/specs
> Configured with:
> ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host=
> mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --en
> able
> -languages=f77,c++,objc,ada --disable-win32-registry --disable-shared
> Thread model: win32
> gcc version 3.2 (mingw special 20020817-1)
> 
> and with ld -v:
> 
> C:\WINDOWS>ld -v
> GNU ld version 2.13
> 
> I got this error on two computers, one with Windows 98 and one with Windows
> XP.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-04-12 22:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-12 22:05 gcc doesn't know <iostream> ?! Christine Tobler
2004-04-12 22:20 ` llewelly

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).