Keeping console window open when running the exe file

  • Thread starter Thread starter hashingsmurf
  • Start date Start date
H

hashingsmurf

Guest
Hi

I am very new to C++ and doing teach myself and got stuck so please take this into account for such a naive question. Everyone has to start somewhere.

I am using Widows 10 - 64 bit

I have compiled my first code as suggested by the tutorial as follows.

#include <iostream>
int main()
{
std::cout << "Hello, world!";
return 0;
}


After doing "debug build - X86" and "start without debuging" it runs as expected.

After I did "Build Release - X86" At first I could not find the .exe file in the solution explorer.

I then changed the solution explorer to folder view and found an exe file in a folder "Release". (I also noted that the build options window changes to No Configurations when in folder view. In case that is relevant.)

I then went to the .exe file in windows explorer and ran it. This appeared to flick the console window open and closed again.

My question is. What do I need to do to keep the console window open till I press a key when running the .exe file (as it does when I select "start without debuging" within Visual Studio) ? ie how can I keep the console window open to see if my program works?

I have searched my tutorial and the internet without success.

Many thanks

Continue reading...
 
Back
Top