Hello I have a problem. I wrote some code which I include in my application, it was wroking in CodeBlocks, but I changed enviroment to VS2010, now I have errors.
This is ClientHandler.h :
This is ClientHandler.cpp:Code:#ifndef CLIENT_HANDLER_H #define CLIENT_HANDLER_H #include <windows.h> #include <boost/thread/thread.hpp> class ClientHandler { private: public: ClientHandler(); ~ClientHandler(){} int StartListen(); DWORD WINAPI ServeClient(int ID); DWORD WINAPI WaitClients(int ok); }; extern ClientHandler CHandler; #endif
What is get is :Code:#include "stdafx.h" #include "ClientHandler.h" #include <utility> ... int ClientHandler::StartListen() { if (StartedListen) { printf("ClientHandler::Initialize::Already Initialized!\n"); return 0; } printf("ClientHandler::Initialize\n"); if (NHandler.ListenSocket != INVALID_SOCKET) { boost::thread thread(&ClientHandler::WaitClients, CHandler, 0); ///<------ not working listenthread = std::move(thread); StartedListen = 1; } else printf("ClientHandler::Listener::Startup failed\n"); return 0; } DWORD ClientHandler::WaitClients(int ok) { ... }
Code:1> ClientHandler.cpp 1> Including from ClientHandler.cpp: Including NetworkHandler.h... 1> Included from ClientHandler.cpp: Included NetworkHandler.h... 1> Including from ClientHandler.cpp: Including thread.h... 1> Included from ClientHandler.cpp: Included thread.h... 1>h:\boost_vs\boost_1_46_1\boost\bind\mem_fn.hpp(318): warning C4180: qualifier applied to function type has no meaning; ignored 1> h:\boost_vs\boost_1_46_1\boost\bind\bind.hpp(313) : see reference to class template instantiation 'boost::_mfi::dm<R,T>' being compiled 1> with 1> [ 1> R=DWORD (int), 1> T=ClientHandler 1> ] 1> h:\boost_vs\boost_1_46_1\boost\bind\bind_template.hpp(20) : see reference to function template instantiation 'void boost::_bi::list2<A1,A2>::operator ()<F,boost::_bi::list0>(boost::_bi::type<T>,F &,A &,int)' being compiled 1> with 1> [ 1> A1=boost::_bi::value<ClientHandler>, 1> A2=boost::_bi::value<int>, 1> F=DWORD (__stdcall ClientHandler::* )(int), 1> T=void, 1> A=boost::_bi::list0 1> ] 1> h:\boost_vs\boost_1_46_1\boost\bind\bind_template.hpp(18) : while compiling class template member function 'void boost::_bi::bind_t<R,F,L>::operator ()(void)' 1> with 1> [ 1> R=void, 1> F=unsigned long (__stdcall ClientHandler::* )(int), 1> L=boost::_bi::list2<boost::_bi::value<ClientHandler>,boost::_bi::value<int>> 1> ] 1> h:\boost_vs\boost_1_46_1\boost\thread\detail\thread.hpp(256) : see reference to class template instantiation 'boost::_bi::bind_t<R,F,L>' being compiled 1> with 1> [ 1> R=void, 1> F=unsigned long (__stdcall ClientHandler::* )(int), 1> L=boost::_bi::list2<boost::_bi::value<ClientHandler>,boost::_bi::value<int>> 1> ] 1> b:\server\units\clienthandler.cpp(41) : see reference to function template instantiation 'boost::thread::thread<DWORD(__stdcall ClientHandler::* )(int),ClientHandler,int>(F,A1,A2)' being compiled 1> with 1> [ 1> F=DWORD (__stdcall ClientHandler::* )(int), 1> A1=ClientHandler, 1> A2=int 1> ] 1>h:\boost_vs\boost_1_46_1\boost\bind\mem_fn.hpp(326): warning C4180: qualifier applied to function type has no meaning; ignored 1>h:\boost_vs\boost_1_46_1\boost\bind\mem_fn.hpp(331): warning C4180: qualifier applied to function type has no meaning; ignored 1>h:\boost_vs\boost_1_46_1\boost\bind\mem_fn.hpp(345): warning C4180: qualifier applied to function type has no meaning; ignored 1>h:\boost_vs\boost_1_46_1\boost\bind\mem_fn.hpp(350): warning C4180: qualifier applied to function type has no meaning; ignored 1>h:\boost_vs\boost_1_46_1\boost\bind\mem_fn.hpp(362): warning C4180: qualifier applied to function type has no meaning; ignored 1>h:\boost_vs\boost_1_46_1\boost\bind\bind.hpp(313): error C2064: term does not evaluate to a function taking 2 arguments 1> class does not define an 'operator()' or a user defined conversion operator to a pointer-to-function or reference-to-function that takes appropriate number of arguments 1> Generating Code... 1> Compiling... 1> NetworkHandler.cpp 1> Generating Code... 1> 1>Build FAILED.



LinkBack URL
About LinkBacks




Thx