locked
I have a question?? RRS feed

  • Question

  • Hello everyone,
    I have a compiling/running question,  after compiling a chosen program,  How do I execute that program?
    Meaning to see the output results on the running screen.  As you can see I'm quite new at this. I have never done this before, so please help ok.

    Richard West,  Registered Visual C++ User

    Tuesday, December 22, 2009 5:36 AM

Answers

  • From within the Visual Studio IDE you can either press F5 to run with debugging or press Ctrl+F5 to run without debugging.
    From outside the IDE you can double click on the .EXE file from Windows explorer or type the name of the .EXE file and press ENTER from a command prompt.

    Note that if you're running a console application from within the IDE, the output window may not stay open for you to see the results.
    You could put a getchar() before the return statement in the main function so that the program waits till you press ENTER.


    «_Superman_»
    Microsoft MVP (Visual C++)
    • Marked as answer by Wesley Yao Monday, December 28, 2009 3:01 AM
    Tuesday, December 22, 2009 5:43 AM
  • Just use a getch() before the return statement in your main(). This makes your output screen to wait for a character input before it exits.
    To use getch() you should include the header #include <conio.h>


    Thanks,
    Mani

    • Marked as answer by Wesley Yao Monday, December 28, 2009 3:02 AM
    Tuesday, December 22, 2009 5:43 AM

All replies

  • From within the Visual Studio IDE you can either press F5 to run with debugging or press Ctrl+F5 to run without debugging.
    From outside the IDE you can double click on the .EXE file from Windows explorer or type the name of the .EXE file and press ENTER from a command prompt.

    Note that if you're running a console application from within the IDE, the output window may not stay open for you to see the results.
    You could put a getchar() before the return statement in the main function so that the program waits till you press ENTER.


    «_Superman_»
    Microsoft MVP (Visual C++)
    • Marked as answer by Wesley Yao Monday, December 28, 2009 3:01 AM
    Tuesday, December 22, 2009 5:43 AM
  • Just use a getch() before the return statement in your main(). This makes your output screen to wait for a character input before it exits.
    To use getch() you should include the header #include <conio.h>


    Thanks,
    Mani

    • Marked as answer by Wesley Yao Monday, December 28, 2009 3:02 AM
    Tuesday, December 22, 2009 5:43 AM
  • Always specify which compiler and version you're using, as the
    answer(s) may differ for different environments.

    Also state how you are building (compiling *and* linking) your programs.
    From inside an IDE (Integrated Development Environment) or from a console
    command line?

    - Wayne
    Tuesday, December 22, 2009 5:46 AM