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");
^
コードを確認しましたが、このエラーの理由がわかりません。コンパイラを変更する必要がありますか、それともこのコードに誤りがありますか?