Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ std::system 'system' not a Member of std

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.

like image 785
Paradius Avatar asked Sep 18 '09 21:09

Paradius


1 Answers

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.

like image 147
Steve Jessop Avatar answered Oct 07 '22 19:10

Steve Jessop