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

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -