How to RUN C by Microsoft Visual Studio

M

Mike

Hi

I would like to use microsoft visual studio to compile a C program.
Does somebody know how to compile, link and run it?
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?).
A console window just appears and close very quickly.
How can I pause the console window?

Mike
 
I

Ian Collins

Mike said:
Hi

I would like to use microsoft visual studio to compile a C program.
Does somebody know how to compile, link and run it?

That somebody will be reading one of the visual studio groups!
 
K

Kenneth Brody

Mike said:
Hi

I would like to use microsoft visual studio to compile a C program.
Does somebody know how to compile, link and run it?
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?).

<OT>
Ctrl-F5. It's right there in the "build" menu. I can't answer "why"
you cannot find it.
A console window just appears and close very quickly.
How can I pause the console window?

Dunno. My programs always pause after running, if run with the IDE.
You'll need to ask in one of the Microsoft-related newsgroups why yours
doesn't.

--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:[email protected]>
 
M

Malcolm McLean

Mike said:
Hi

I would like to use microsoft visual studio to compile a C program.
Does somebody know how to compile, link and run it?
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?).
You'd have to ask Microsoft that one. The IDE is rather fiddly to use,
though quite powerful when you get used to it.
A console window just appears and close very quickly.
How can I pause the console window?
Call getchar() before your program exits. This forces it to read input from
stdin, or keyboard.
 
P

pete

Mike said:
Hi

I would like to use microsoft visual studio to compile a C program.
Does somebody know how to compile,

Ctrl F7
link
F7

and run it?
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?).
A console window just appears and close very quickly.
How can I pause the console window?

Don't run the program from the MSVC console window.
Open another window from outside of MSVC,
and cd (change directory) to where the executable files wind up,
amd run your programs from there.
 
R

Richard Heathfield

pete said:
Ctrl F7


F7

Well, I'm not about to fire up a Windows machine to check, but ISTR that
the exact keypresses may depend on which keyboard bindings you selected
when you installed VS. The reason I use weasel words like "may" is that I
may be disremembering - it may only be the editor itself to which these
choices apply.
Don't run the program from the MSVC console window.

Good advice, but there is an alternative: Ctrl-F5 (or whatever), which runs
the program outside the debugger and displays the legend "Press any key to
continue" (or some trivial variant thereof) when the program terminates.
Open another window from outside of MSVC,

A console window, that is. In modern Windowses, this can be done by
pressing Windows-R and entering the command

cmd

In older Windowses, the command is

command
and cd (change directory) to where the executable files wind up,
amd run your programs from there.

Right. Note that the executable files tend to be created in subdirectories
of the development directory, with the default names "debug" or "release",
depending on whether you're building a debug version or a release version.

Might I suggest that any further discussion of this stuff more properly
belongs in comp.os.ms-windows.programmer.win32 or one of the Microsoft
groups?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top