error: 'system' was not declared in this scope

来源:互联网 发布:js promise 编辑:程序博客网 时间:2024/06/01 08:34
error: 'system' was not declared in this scope

means that your compiler has never heard of such a thing as system, because you have not declared it. You can include the declaration by including the cstdlib header, i.e.
 
#include <cstdlib> 


Use of system is frowned upon because it asks the shell you are executing in to run some other programme for you. You have no guarantee that the other programme exists, and no guarantee that it does what you want.

If you just want to pause your programme, do as the Kitten says, or alternatively if you just want the console window to remain visible, run your programme from a console.
原创粉丝点击