Creating two files: ==== t1.cpp === #include <tr1/unordered_map>
std::tr1::unordered_map<int,int> map1; int main() {} ==== t2.cpp ==== #include <tr1/unordered_map> std::tr1::unordered_map<int, float> map; int t2(int i) { return 0; } ============= compiling them with g++ -Wall t1.cpp t2.cpp leads to compiler output: t2.o:(.bss+0x20): multiple definition of `std::tr1::placeholders::(anonymous namespace)::_10' t1.o:(.bss+0x20): first defined here t2.o:(.bss+0x21): multiple definition of `std::tr1::placeholders::(anonymous namespace)::_9' t1.o:(.bss+0x21): first defined here t2.o:(.bss+0x22): multiple definition of `std::tr1::placeholders::(anonymous namespace)::_8' t1.o:(.bss+0x22): first defined here t2.o:(.bss+0x23): multiple definition of `std::tr1::placeholders::(anonymous namespace)::_7' t1.o:(.bss+0x23): first defined here t2.o:(.bss+0x24): multiple definition of `std::tr1::placeholders::(anonymous namespace)::_6' t1.o:(.bss+0x24): first defined here t2.o:(.bss+0x25): multiple definition of `std::tr1::placeholders::(anonymous namespace)::_5' t1.o:(.bss+0x25): first defined here t2.o:(.bss+0x26): multiple definition of `std::tr1::placeholders::(anonymous namespace)::_4' t1.o:(.bss+0x26): first defined here t2.o:(.bss+0x27): multiple definition of `std::tr1::placeholders::(anonymous namespace)::_3' t1.o:(.bss+0x27): first defined here t2.o:(.bss+0x28): multiple definition of `std::tr1::placeholders::(anonymous namespace)::_2' t1.o:(.bss+0x28): first defined here t2.o:(.bss+0x29): multiple definition of `std::tr1::placeholders::(anonymous namespace)::_1' t1.o:(.bss+0x29): first defined here t2.o:(.bss+0x2a): multiple definition of `std::tr1::(anonymous namespace)::ignore' t1.o:(.bss+0x2a): first defined here t2.o:(.data+0x0): multiple definition of `_ZN8Internal1XIXT_EE8n_primesE' t1.o:(.data+0x0): first defined here ========== Thus preventing use of two unordered_map's in a single application. g++ -v: Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.0 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr --disable-werror --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.0.2 (Debian 4.0.2-2) -- Summary: tr1::unordered_map duplicate symbols (not extern?) Product: gcc Version: 4.0.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: maarten dot keijzer at gmail dot com GCC host triplet: Linux version 2.6.10 GCC target triplet: g++ 4.0.2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24390