Visual Studio Basics
The following directions should get you started using Visual Studio to write C or C++ programs. These directions apply to Microsoft Visual C++ .NET (MDE version 7.1; .NET version 1.1). There may be other ways to successfully write C code in Visual Studio, but this way will work.
Create a new Win32 Console project. Go to "File -> New -> Project...". Select "Win32 Console Project", which can be found in the "Visual C++ Projects" folder. Select a name for your project (such as Assignment 1) and folder where your project will be stored. When the Win32 Application Wizard dialog appears to confirm you choice, go to Application Settings and check the "Empty Project" box. Then click Finish.
Add a .c file to your project. Go to "File -> Add New Item...". Select the C++ file icon, and name your file. If you want to write C code, give your file a .c extension when you name it. For example, name your file "hello.c".
Write your code. Don't forget to save it.
Compile your project. You can do this by going to "Build -> Build A1" (if A1 is the name of your project). "Build -> Build Solution" should also work. "Build -> Compile" will compile but not link your code.
Run your code. To do this, you can go to "Debug -> Start". However, the console window in which your code runs will close automatically when the program exits. If your program never pauses or asks for input, you will never see your output. You can run your program from the command prompt, however. (You can get to the command prompt on Windows XP by going "Start -> Programs -> Accessories -> Command Prompt". Move into the folder where your project is stored; your executable is in the "Debug" subdirectory. Type the name of your .exe file to run your program.)
|~ztomasze Index :
TA Details : ICS212 : Visual Studio
|Last Edited: 22 Jan 2004|
©2004 by Z. Tomaszewski.