# Vector push_back causing linker errors

This topic is 4873 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi i'm having a lot of trouble with the stl vector. It keeps throwing me linker errors whenever I try to use push_back. The errors I am getting are: [Linker error] undefined reference to std::_GLIBCPP_mutex_init(' [Linker error] undefined reference to std::_GLIBCPP_once' [Linker error] undefined reference to `std::_GLIBCPP_mutex' [Linker error] undefined reference to std::_GLIBCPP_mutex_address_init()' there are a few more but they are all very similar. In a class I have the line vector<char*> textureNames; and in the same header file i have #include <vector> using namespace std; and in one of the methods: textureNames.push_back("hello"); If i comment out that line, everything compiles. This has me stumped and I cant find any info on the errors. So any help would be great, i'm using Dev C++. Thanks Kazade.

##### Share on other sites
I know this is not the same but still. Why don't you use: std::vector<std::string> textureNames;

##### Share on other sites
Thats what i was using, i changed it so that i could find what exactly was going wrong :)

##### Share on other sites
I think so, everything else is working fine, the moment i use stl it throws those errors at me.

##### Share on other sites
Probably someone using Dev C++ should know a bit more, but I'm almost sure this comes form library mismatch, since errors are from linker and the term 'mutex' comes form multithreading enviroment.

##### Share on other sites
I had a very similar error on a recent DevC++ project but for the life of me I can't remember how I fixed it, I'm sure it had something to do with multiple #include's of the same header: I think I just did a #ifndef #define..#endif around the code and that fixed it.

Sorry I couldn't be of more help mate :(

##### Share on other sites
It's ok, I got it fixed, I had to completely uninstall dev c++, reinstall it, then install different versions of wxWidgets one at a time to make it work. It must have been something to do with that, i forgot to mention it in my post i didnt think it would be related. Still not sure exactly what was wrong, but its working now so i dont care ;)

Cheers guys.