gcc не компилит c++ исходники
Добавлено: 28 апр 2006, 10:54
Такая проблемка появилась: когда пытаюсь скомпилировать C++ исходник
вылазит это:
То, что у меня стоит:
Код: Выделить всё
#include <iostream>
using namespace std;
int main()
{
cout << "Hello\n";
return 0;
}
Код: Выделить всё
[silos@asakura test]$ gcc main.cpp
/tmp/cc0bXYoP.o: In function `__static_initialization_and_destruction_0(int, int)':main.cpp:(.text+0x23): undefined reference to `std::ios_base::Init::Init()'
/tmp/cc0bXYoP.o: In function `__tcf_0':main.cpp:(.text+0x6c): undefined reference to `std::ios_base::Init::~Init()'
/tmp/cc0bXYoP.o: In function `main':main.cpp:(.text+0x8e): undefined reference to `std::cout'
:main.cpp:(.text+0x93): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/tmp/cc0bXYoP.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
Код: Выделить всё
[silos@asakura test]$ gcc -x c++ -o test main.cpp
/tmp/ccKq7mGP.o: In function `__static_initialization_and_destruction_0(int, int)':main.cpp:(.text+0x23): undefined reference to `std::ios_base::Init::Init()'
/tmp/ccKq7mGP.o: In function `__tcf_0':main.cpp:(.text+0x6c): undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccKq7mGP.o: In function `main':main.cpp:(.text+0x8e): undefined reference to `std::cout'
:main.cpp:(.text+0x93): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/tmp/ccKq7mGP.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
Код: Выделить всё
[silos@asakura test]$ gcc --version
gcc (GCC) 4.1.0 20060304 (Red Hat 4.1.0-3)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[silos@asakura test]$ uname -a
Linux asakura.org 2.6.16-1.2096_FC5 #1 Wed Apr 19 05:14:36 EDT 2006 i686 athlon i386 GNU/Linux