Всем привет!
Хочу скомпильнуть сей неказистый код:
#include <iostream>
using namespace std;
int main( )
{
int count = 10;
int& countRef = count;
auto myAuto = countRef;
countRef = 11;
cout << count << " ";
myAuto = 12;
cout << count << endl;
}
$ gcc -std=c++11 delme.cpp
/tmp/ccrF4TIa.o: In function `main':
delme.cpp:(.text+0x38): undefined reference to `std::cout'
delme.cpp:(.text+0x3d): undefined reference to `std::ostream::operator<<(int)'
delme.cpp:(.text+0x4d): 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*)'
delme.cpp:(.text+0x64): undefined reference to `std::cout'
delme.cpp:(.text+0x69): undefined reference to `std::ostream::operator<<(int)'
delme.cpp:(.text+0x71): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
delme.cpp:(.text+0x79): undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
/tmp/ccrF4TIa.o: In function `__static_initialization_and_destruction_0(int, int)':
delme.cpp:(.text+0xab): undefined reference to `std::ios_base::Init::Init()'
delme.cpp:(.text+0xc2): undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccrF4TIa.o:(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
collect2: error: ld returned 1 exit status
$ gcc --version
gcc (Gentoo 4.7.3 p1.0, pie-0.5.5) 4.7.3
Copyright (C) 2012 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.
$ emerge -pv gcc
These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild R ] sys-devel/gcc-4.7.3:4.7 USE="cxx fortran mudflap nls nptl openmp (-altivec) -doc (-fixed-point) -gcj -go -graphite -gtk (-hardened) (-libssp) -lto (-multilib) -multislot -nopie -nossp -objc -objc++ -objc-gc -regression-test -vanilla" 0 kB
Total: 1 package (1 reinstall), Size of downloads: 0 kB
ЧЯДНТ?