我想從Wrox's Professional C++編譯這個簡單程序TEST.CPP:如何用std :: bind編譯C++程序?
#include<iostream>
#include<functional>
using namespace std;
void func(int num, const string& str)
{
cout << num << ' ' << str << endl;
}
int main()
{
string str = "abc";
auto f = bind(func, placeholders::_1, str);
f(16);
}
我有G ++(Debian的4.4.5-8)4.4.5 compilator我用它這樣的:
g++ -std = c++0x test.cpp -o test
我得到的錯誤:
error: no match for call to ‘(std::_Bind<void (*(std::_Placeholder<1>, int))
(int, int)>) (int)’
爲什麼程序不能編譯?
我無法編譯C++ Reference的示例程序。
對我的作品(GCC支持4.8.1)。您可能需要更新您的編譯器。 – Rapptz
'apt-get install g ++'後,我收到消息「該程序已經在最新版本」。是否有可能在Debian Squeeze中升級g ++ 4.4? – cpp