Re: How to RUN C by Microsoft Visual Studio 選項
- From: Ulrich Eckhardt <eckhardt@xxxxxxxxxxxxxx>
- Date: Wed, 27 Feb 2008 10:46:12 +0100
Mike wrote:
I would like to use microsoft visual studio to compile a C program.
Does somebody know how to compile, link and run it?
Create an empty project and add the sourcefile to it. Keep in mind that the
compiler by default assumes C only for .c files and uses C++ for .cpp
files.
I create a project and add a program to it.
I press F5 to start debug (because I cannot find any command to run,
why?).
Control-F5, I think.
A console window just appears and close very quickly.
Well, your program is started, it creates a console window, does whatever it
should do and then terminates and closes the output window.
How can I pause the console window?
There are several ways:
- Create an endless loop at the end of the program (while(1);).
- Set a breakpoint near the end (F9 toggles breakpoints for a line).
- Wait for the user to press a key (getc comes to mind).
- Don't run the program from the IDE but from a commandline shell.
I typically use the second or third way, the third way typically dependant
on the result of IsDebuggerPresent().
Uli
--
C++ FAQ: http://parashift.com/c++-faq-lite
Sator Laser GmbH
Geschäftsführer: Michael Wöhrmann, Amtsgericht Hamburg HR B62 932
.
- Follow-Ups:
- Re: How to RUN C by Microsoft Visual Studio 選項
- From: Brian Muth
- Re: How to RUN C by Microsoft Visual Studio 選項
- References:
- How to RUN C by Microsoft Visual Studio 選項
- From: Mike
- How to RUN C by Microsoft Visual Studio 選項
- Prev by Date: Re: struct inside a class
- Next by Date: Re: macro
- Previous by thread: How to RUN C by Microsoft Visual Studio 選項
- Next by thread: Re: How to RUN C by Microsoft Visual Studio 選項
- Index(es):
Relevant Pages
|