This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Weirdness with PCH and <string>


Hi,

I have already reported about this on libstdc++ (and Benjamin
is already looking a bit into it), but perhaps it's worth a
repost on gcc, which seems more read overall...

Consider:

paolo:~> more header.h
#include <string>
#include <iostream>
paolo:~> g++ header.h
paolo:~> more test2.cc
#include "header.h"
int main()
{
std::string str = "Paolo";
//char* str = "Paolo";

std::cout << str << '\n';
}
paolo:~> g++ test2.cc
/tmp/ccSZfk3p.o: In function `main':
/tmp/ccSZfk3p.o(.text+0x18): undefined reference to `std::allocator<char>::allocator[in-charge]()'
/tmp/ccSZfk3p.o(.text+0x32): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string[in-charge](char const*, std::allocator<char> const&)'
/tmp/ccSZfk3p.o(.text+0x45): undefined reference to `std::allocator<char>::~allocator [in-charge]()'
/tmp/ccSZfk3p.o(.text+0x5e): undefined reference to `std::allocator<char>::~allocator [in-charge]()'
/tmp/ccSZfk3p.o(.text+0x71): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/ccSZfk3p.o(.text+0x94): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string [in-charge]()'
/tmp/ccSZfk3p.o(.text+0xad): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string [in-charge]()'
collect2: ld returned 1 exit status

???


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]