我有一个用 C++ 编写的非常简单的程序,请在此处查看:
#include <iostream>
using namespace std;
int main()
{
cout<<"Simple message"<<endl;
system("msg * test message");
return 0;
}
当我尝试使用 command: 编译此脚本时g++ 1.cpp -o test.exe
,出现错误:
1.cpp: In function 'int main()':
1.cpp:6:29: error: 'system' was not declared in this scope
system("msg * test message");
^
我检查了代码,但我找不到这个错误的原因,我应该改变编译器还是这个代码有错误?