This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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]

Re: using PCH branch to make precompiled std include


Benjamin Kosnik wrote:

... anybody done it? Is it capable of such magic? Seems like the way to
go. I've not used this branch at all, but am curious.
Hi Benjamin!

I tried, and it's really fast... when it works ;-)

Perhaps I'm missing something important, but the following works:

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

std::cout << str << '\n';
}
paolo:~> g++ test.cc

On my P4 it's:
0.180u 0.010s 0:00.19 100.0%
vs
1.030u 0.010s 0:01.04 100.0%

Pretty good!

... on the other hand, unfortunately:

paolo:~> more test2.cc
#include "header.h"

int main()
{
std::string str = "Paolo";
//char* str = "Paolo";

std::cout << str << '\n';
}
paolo:~> g++ test.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

????

Paolo.


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