2013-05-15 49 views
2

我正在寫一個連接到CAN接口的C++程序(用於arm架構)。 我正在使用標準套接字,綁定,recv和send函數。 現在我處於需要將一些函數外包給線程的地步。 爲此,我想使用C++ 0x線程,因爲我在這裏讀到pthreads不應該用於C++應有的兼容性問題。所以我包括線程庫#include <thread>。並添加到我的編譯器調用的選項-Wno-psabi -std=c++0x -lpthreadC++ 0x線程和套接字

-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&)

我認爲來自線程庫的綁定函數正在重寫來自套接字的綁定函數。

如何告訴編譯器什麼時候使用什麼函數?

IM使用arm-linux-gnueabi-g++版本4.4.5

+1

嘗試使用':: bind'的C函數,或者不使用'使用命名空間std'並完全限定你的'std'函數調用。 – didierc

+1

::綁定作品。 但我即將限定我的'std'函數調用。謝謝! 如果你可以發佈這個答案,我會將它標記爲正確的答案。 – baam

回答