I receive an error compiling a C++ program in which of the lines makes a call from "std::system(SomeString)". This program compiled 3 years ago, but when compiling it today, I receive an error that states ‘system’ is not a member of ‘std’. Is there something that I must import to use std::system, has it been abandoned, or has it moved to another header file.
+10
A:
std::system
is (and always has been) in <cstdlib>
.
It is not defined by the C++ standard whether standard headers include each other, and if so which ones. So it's possible that 3 years ago, on a different compiler or a different version of the same compiler, your code worked by accident, because one of the headers you include just so happened to include <cstdlib>
. On the compiler/version you're using now, it doesn't.
Steve Jessop
2009-09-18 22:03:38