一切工作和編譯很好,直到我#include <unistd.h>
(這是我的CPP單修改),其完全地打破了一切:C++如果<unistd.h>奇怪的編譯錯誤,包括
test.cpp:173:33: error: no matching function for call to ‘std::thread::thread(, int, int, int)’ std::thread t1(read, 1, 0, 3), ^test.cpp:173:33: note: candidates are: In file included from test.cpp:6:0: /usr/include/c++/4.8/thread:133:7: note: template std::thread::thread(_Callable&&, _Args&& ...) thread(_Callable&& __f, _Args&&... __args)
[200 more similar lines]
沒有#include <unistd.h>
一切工作和編譯,但我需要它爲https://stackoverflow.com/a/6856689/1879409
注:我之前通過apt-get安裝ncurses,也許這打破了我的環境?
看起來你的'read'已經超載了:http://pubs.opengroup.org/onlinepubs/7908799/xsh/read.html – krzaq
聽起來像''給全局命名空間增加了一個'read'函數。你用'std :: thread t1(read,1,0,3)'使用了什麼'read'函數? –
NathanOliver
@OP在編輯錯誤消息時不會注意到代碼塊很難閱讀,並且會從消息中刪除信息。例如,<未解析的重載函數類型>被刪除,因爲它被視爲HTML標記。 – NathanOliver