View previous topic :: View next topic |
Author |
Message |
mikix Guest
|
Posted: Sun Apr 28, 2002 12:14 am Post subject: Undefined references |
|
|
Hello. I am compiling a program, using the STD list data structure, and I get the following linking errors:
Code: |
map.o: In function `__malloc_alloc_template<0>::_S_oom_malloc(unsigned int)':
map.o(.__malloc_alloc_template<0>::gnu.linkonce.t._S_oom_malloc(unsigned int)+0x1a): undefined reference to `endl(ostream &)'
map.o(.__malloc_alloc_template<0>::gnu.linkonce.t._S_oom_malloc(unsigned int)+0x27): undefined reference to `cerr'
map.o(.__malloc_alloc_template<0>::gnu.linkonce.t._S_oom_malloc(unsigned int)+0x2c): undefined reference to `ostream::operator<<(char const *)'
map.o(.__malloc_alloc_template<0>::gnu.linkonce.t._S_oom_malloc(unsigned int)+0x37): undefined reference to `ostream::operator<<(ostream &(*)(ostream &))'
collect2: ld returned 1 exit status
|
Now, from browsing around online, I found that this means my STL libraries are messed up somehow, and this has something to do with the libstdc++ package. Gentoo doesn't seem to have this package. I installed the STLport package and specified -I/usr/include/stlport, which just produced more of the same errors. How would I go about fixing this problem?
Thanks in advance,
Michael Terry |
|
Back to top |
|
|
mikix Guest
|
Posted: Sun Apr 28, 2002 12:57 am Post subject: Fixed it |
|
|
Ok. After talking to a friend, I added the linking flag -lstdc++, it worked without "using namespace std;" or any other changes. |
|
Back to top |
|
|
Nitro Bodhisattva
Joined: 08 Apr 2002 Posts: 661 Location: San Francisco
|
Posted: Sun Apr 28, 2002 1:02 am Post subject: |
|
|
Thanks for following up, nice to hear people's answers instead of just their problems. _________________ - Kyle Manna
Please, please SEARCH before posting.
There are three kinds of people in the world: those who can count, and those who can't. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|