Am using wxDev compiler, I tried to use system ("pause") ; a code line I always use at the end of main () on an old c++Compiler to help pause the program after running on console. Then I will have to Press any key to continue. But it's not working on wxDev compiler, it says 'system' was not declared in this scope. Pls how do I pause my console to see the output of my program
The function "system()" is exposed in the header file 'cstdlib'. You have to include this header file in order to use it.
Why are you pausing the program at all? Console applications should be run from a console shell. So start up 'cmd.exe', cd to the projects output directory and call your application.
- First you open the command prompt. This is done by pressing 'Windows Key + R'. Type 'cmd' into text field on the box that pops up.
- Then, using Windows Explorer, navigate to the folder where your compiled program, not your project file, is stored.
- Copy the address from the address bar and go back to your command prompt window.
- In the command prompt window type 'cd' without the quotes and then a space.
- After the space right click on the command prompt window and select paste from the context menu, then press 'Enter'. NOTE: 'Ctrl+V' does not paste text in this environment.
- Then type the name of your executable and press 'Enter' again.