Ubuntu上vscode报错——pause: not found

it2025-08-13  5

#include<iostream> using namespace std; int main(){ system("pause"); return 0; }

这串代码放在windows系统的vscode上并不会报错,而是闪现一个窗口;但是在Ubuntu的vscode中会有如题所示的报错。这个时候只需加上一条编译预处理命令即可:

#include<iostream> #include<unistd.h> using namespace std; int main(){ system("pause"); return 0; }

加上之后就可以正常运行,不会产生error。

最新回复(0)