c++ - compiler error on calling boost::bind() inside boost::thread constructor -


i writing firebreath c++ npapi plugin, , trying invoke boost::thread inside plugin. platform building ubuntu linux 13.04. here skeleton of class declaration , relevant member function implementations:

class emulatorlaunchpluginapi : public fb::jsapiauto { public:    emulatorlaunchpluginapi(const emulatorlaunchpluginptr& plugin,                            const fb::browserhostptr& host):m_plugin(plugin), m_host(host)   {       registermethod("launch_emulator",                     make_method(this, &emulatorlaunchpluginapi::launch_emulator));        registermethod("launch_emulator_thread",                     make_method(this, &emulatorlaunchpluginapi::launch_emulator_thread));   }     virtual ~emulatorlaunchpluginapi() {};     emulatorlaunchpluginptr getplugin()     {         emulatorlaunchpluginptr plugin(m_plugin.lock());         if (!plugin) {             throw fb::script_error("the plugin invalid");         }         return plugin;     }        bool launch_emulator(const std::string& ,const fb::jsobjectptr& )     {          emt(boost::bind(//boost::type<void>(),         &emulatorlaunchpluginapi::launch_emulator_thread,         this,         cmd,                 callback));         return true;     }     void launch_emulator_thread(const std::string& , const fb::jsobjectptr& )     {          //thread body logic here          int result = 0;          result = invoke_command(cmd);           //callback browser          callback->invokeasync("", fb::variant_list_of(shared_from_this())(result));     }  private:     int invoke_command(const std::string& )     {         int res = system("/usr/bin/firefox");          return res;     }      emulatorlaunchpluginweakptr m_plugin;     fb::browserhostptr m_host;     boost::thread emt;   };  getting following compile error code fragmented highlighted above: 

[ 54%] building cxx object projects/emulatorlaunchplugin/cmakefiles/emulatorlaunchplugin.dir/emulatorlaunchpluginapi.cpp.o /home/ajay/downloads/firebreath-firebreath-c335f5b/projects/emulatorlaunchplugin/emulatorlaunchpluginapi.cpp: in member function ‘bool emulatorlaunchpluginapi::launch_emulator(const string&, const jsobjectptr&)’: /home/ajay/downloads/firebreath-firebreath-c335f5b/projects/emulatorlaunchplugin/emulatorlaunchpluginapi.cpp:94:30: error: no match call ‘(boost::thread) (boost::_bi::bind_t&, const boost::shared_ptr&>, boost::_bi::list3, boost::_bi::value >, boost::_bi::value > > >)’ make[2]: * [projects/emulatorlaunchplugin/cmakefiles/emulatorlaunchplugin.dir/emulatorlaunchpluginapi.cpp.o] error 1 make[1]: [projects/emulatorlaunchplugin/cmakefiles/emulatorlaunchplugin.dir/all] error 2 make: ** [all] error 2

i new boost libraries, , did try understand how boost::bind works, not resolve error. can please me understand compiler's behavior?

regards, ajay

try changing line to:

emt = boost::thread(&emulatorlaunchpluginapi::launch_emulator_thread, this, cmd, callback)); 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -