whats wrong with my c++ list<string> -
bee.cpp
list<string> urls; urls.push_back ("one"); urls.push_back ("two"); urls.push_back ("three"); urls.sort(); tp(urls);
tp.h
namespace std { class tp { public: tp(list<string> u); virtual ~threadpool(); }; }
tp.c++
tp::tp(list<string> u) { list<string>::iterator it; (it=mylist.begin(); it!=mylist.end(); ++it) cout << " " << *it; } tp::~tp() { // todo auto-generated destructor stub }
it works in same function under 1 file if use class shows me error
../src/bee.cpp: in function ‘int main()’: ../src/bee.cpp:31: error: conflicting declaration ‘std::tp u’ ../src/bee.cpp:24: error: ‘u’ has previous declaration ‘std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > u’ } #endif /* tp_h_ */ tp.h
fred larson speculated code wrong because you've been illegally adding stuff std::
namespace. that's true. however, looking @ error ‘std::tp u’, it's clear aren't showing relevant code @ all. have 2 declarations of u
in bee.cpp, , code excerpt shows neither.
Comments
Post a Comment