This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Weirdness with PCH and <string>
- From: Paolo Carlini <pcarlini at unitus dot it>
- To: gcc at gcc dot gnu dot org
- Cc: Geoffrey Keating <gkeating at apple dot com>
- Date: Fri, 20 Dec 2002 10:01:13 +0100
- Subject: 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
???