Now, from browsing around online, I found that this means my STL libraries are messed up somehow, and this has something to do with the libstdc++ package. Gentoo doesn't seem to have this package. I installed the STLport package and specified -I/usr/include/stlport, which just produced more of the same errors. How would I go about fixing this problem?