Vector push_back causing linker errors
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.
I know this is not the same but still. Why don't you use: std::vector<std::string> textureNames;
I think so, everything else is working fine, the moment i use stl it throws those errors at me.
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.
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 :(
Sorry I couldn't be of more help mate :(
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.
Cheers guys.
Kazade.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement