C++ 0x线程和套接字

baa*_*aam 2 sockets multithreading bind c++11

我正在编写一个连接到CAN-Interface的c ++程序(用于arm-architecture).我正在使用标准套接字,绑定,recv和发送功能.现在,我需要将一些功能外包给线程.为此,我想使用C++ 0x Threads,因为我在这里读到了pthreads不应该在c ++中使用的兼容性问题.

所以我包括线程库#include <thread>.并添加到我的编译器调用选项-Wno-psabi -std=c++0x -lpthread

(-Wno-psabi是否禁用该note: the mangling of ‘va_list’ has changed in GCC 4.4消息)

我得到的错误是:

25: error: no match for ‘operator<’ in ‘std::bind(_Functor, _ArgTypes ...) [with _Functor = int, _ArgTypes = sockaddr*, unsigned int](((sockaddr*)(&((can*)this)->can::addr)), 16u) < 0

/usr/arm-linux-gnueabi/include/c++/4.4.5/system_error:258: note: candidates are: bool std::operator<(const std::error_condition&, const std::error_condition&)

/usr/arm-linux-gnueabi/include/c++/4.4.5/system_error:177: note: bool std::operator<(const std::error_code&, const std::error_code&)

我认为来自线程库的bind函数正在从套接字覆盖bind函数.

我如何告诉编译器何时使用什么函数?

即时通讯使用arm-linux-gnueabi-g++4.4.5版

did*_*erc 5

尝试使用::bindC函数,或者不要使用using namespace std并完全限定std函数调用.

还有中间解决方案,请参阅: