• Advertisement
Sign in to follow this  

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
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.

Kazade.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement