vector<T>::push_back()
PlechámÃÂd Martin
Martin.Plechsmid@merlin.cz
Tue Sep 4 00:36:00 GMT 2001
Title: vector<T>::push_back()
Hello.
I noted, that when using the push_back(contst T) method of the vector<T> class, the linker is looking for some iostream functions - even though I don't use the "iostream" library in my program. Other methods don't cause this behaviour. This needn't be a bug, but it seems strange to me.
test.cpp:
ÃÂ ÃÂ #include <vector>
ÃÂ ÃÂ int main(int argc, char* argv[])
ÃÂ ÃÂ {
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ std::vector<long> vv;
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ vv.push_back(2);
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ return 0;
ÃÂ ÃÂ }
When I don't have the appropriate lib-file with iostream functions in the searched path, the linker complains:
ÃÂ ÃÂ test.o: In function `__malloc_alloc_template<0>::_S_oom_malloc(unsigned int)':
ÃÂ ÃÂ test.o(.__malloc_alloc_template<0>::gnu.linkonce.t._S_oom_malloc(unsigned int)+0x1a): undefined reference to `endl(ostream &)'
ÃÂ ÃÂ test.o(.__malloc_alloc_template<0>::gnu.linkonce.t._S_oom_malloc(unsigned int)+0x27): undefined reference to `cerr'
ÃÂ ÃÂ test.o(.__malloc_alloc_template<0>::gnu.linkonce.t._S_oom_malloc(unsigned int)+0x2c): undefined reference to `ostream::operator<<(char const *)'
ÃÂ ÃÂ test.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
Best regards,
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ Martin.
More information about the Libstdc++
mailing list