Creating a Console project with Visual C++
To create a text, or console program (text-based), perform the following
steps:
Note: The name of your project, will become the name of your EXE file.
1. From the File menu choices, select New
2. Make sure the Projects tab is selected, in the New dialog
that appeared
3. Highlight the Win32 Console Application selection
4. Make sure that the Location item has a good directory name
5. Enter the name of the new project (this will automatically change the
Location value).
6. Click OK
Create a new source module, for the project:
7. From the File menu choice, select New
8. Make sure the Files tab is selected in the New dialog that
appeared
9. Highlight the C++ Source file item, and enter the new file name
in the File name area. (Note: for a C class, make sure you specify
the .c, not .cpp extension).
You can now type your code into the source file.
Adding a file from another project to
a project
1. From the Project menu choice, select Add to Project...
2. Select Files, and then locate the desired file.
Note: You do not add .h files to a project.
Also, if you #include a file that's in another directory, you will need
to specify it's path in the #include statement.
To Compile
Select the Build menu choice,
then Build???.exe (where ??? is your project name).
By default, you compile in a 'debug' mode. This means that the EXE file
will have debug information, and will be larger than normal. It also means
that the EXE file will be placed in the Debug directory, off your
project directory, when it is created.
To Run
You can either select the Build
menu choice, and then the Execute ???.exe, or simply press Ctrl-F5.
This will execute the program. If you want to be able to debug the program,
step through it and watch it execute, then either press F5, or select the
Build menu choice, then Start Debug, then Go.
If your program requires command line arguments, you may want to open a
Command Prompt, from the Start button (in Programs,
this is not Visual C++, but Windows). Then, in the command prompt window,
change to the directory containing your EXE file (remember, it may be in
the Debug directory). Then, you can run the program by typing it's
name at the command prompt, with any arguments you want.