我在Ubuntu上使用codeBlocks和GCC 4.7中的boost 1.46 [ yield_k.hpp ],使用C++语言。
我遇到了以下编译时错误:
error : Sleep was not declared in this scope
代码:
#include <iostream>
using namespace std;
int main() {
cout << "nitrate";
cout << flush;
sleep(1000);
cout << "firtilizers";
return 0;
}
我该如何解决这个错误?我希望程序暂停一秒钟。
#include <unistd.h>
,带上尖括号。 - Kerrek SB#include <unistd.h>
在小写字母s
的情况下可以工作。 - y_159