If the "ext/pb_ds/exception.hpp" is included (directly or indirectly) in more than one separate compilation units, all of its __throw_... functions are redefinition.
Fox example: =========== main.cc =========== #include"someclass.h" int main(int argc,char *argv[]) { return(0); } =========== someclass.h =========== #include<ext/pb_ds/exception.hpp> // in gcc 4.2 /* #include<ext/pb_ds/assoc_container.hpp> // in gcc 4.3.0 #include<ext/pb_ds/trie_policy.hpp> #include<ext/pb_ds/tag_and_trait.hpp> */ class someclass { // I want to use pat_trie here. }; =========== someclass.cc =========== #include"someclass.h" ==================================== $ g++ main.cc someclass.cc someclass.cc:(.text+0x0): multiple definition of `pb_ds::__throw_resize_error()' /tmp/cc8LPB2N.o:main.cc:(.text+0x12): first defined here /tmp/ccl19hyr.o: In function `pb_ds::__throw_join_error()': someclass.cc:(.text+0x52): multiple definition of `pb_ds::__throw_join_error()' /tmp/cc8LPB2N.o:main.cc:(.text+0x64): first defined here /tmp/ccl19hyr.o: In function `pb_ds::__throw_insert_error()': someclass.cc:(.text+0xa4): multiple definition of `pb_ds::__throw_insert_error()' /tmp/cc8LPB2N.o:main.cc:(.text+0xb6): first defined here /tmp/ccl19hyr.o: In function `pb_ds::__throw_container_error()': someclass.cc:(.text+0xf6): multiple definition of `pb_ds::__throw_container_error()' /tmp/cc8LPB2N.o:main.cc:(.text+0x108): first defined here collect2: ld returned 1 exit status =========== My solution is to change all of _throw__... functions into inline ones. -- Summary: __throw_* functions in ext/pb_ds/exception.hpp cause multiple definition errors Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: chalathip at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36612