I have a very simple program written in C++, see it here:
#include <iostream>
using namespace std;
int main()
{
cout<<"Simple message"<<endl;
system("msg * test message");
return 0;
}
When I try to compile this script using command: g++ 1.cpp -o test.exe
, I get error:
1.cpp: In function 'int main()':
1.cpp:6:29: error: 'system' was not declared in this scope
system("msg * test message");
^
I checked code, but I can't find the reason of this error, should I change the compiler or is there mistake in in this code?
system()
is defined in stdlib.h
(or cstdlib
for C++).
#include <cstdlib>