Re: gcc doesn't know <iostream> ?!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Christine Tobler" <christine.tobler@xxxxxx> 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.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux