CSC 076

C++

The Visual C++ Environment

Writing a simple C++ program requires completing the following steps:

  1. Go to File on the Menu line and choose New.  Making sure you have chosen the Projects tab, select Win32 Console Application.

  2. Next, click on the line that says:    Project name:     Choose a name for your project; for example, First.  Note, that no extensions are necessary.

  3. Click on the line that says:    Location:     Choose an appropriate directory for your project.  (You'll want to remember this directory when you prepare your work for handing into me later.)  Then click OK.

  4. A dialog box will appear with the radio button "an empty project" already checked.  Click Finish, then OK.

  5. Now, go to the Menu line and choose Project.  Move the cursor to Add to Project, and then to New.  With the Files tab chosen, select C++ Source File and click on the line which says File name.  Now type, say, First.cpp.  Here, the .cpp extension indicates that the file actually contains C++ source code.

  6. Now, you will notice that the cursor is blinking in a blank editor, waiting for you to enter the text which will comprise your program.

  7. After completing your program, go to the Menu item labelled Build.   This pull-down window gives you essentially two choices of interest.  You might decide to simply Compile First.cpp.  This will inform you of any syntax errors in your program.  Or you might combine the compilation step with linking by choosing the Build First.exe option.  This option will expose both syntax errors as well as linking problems associated with missing header files for instance.   In any case, you will have to build First.exe so that you can execute your program.

  8. Finally, after all syntax and linking errors have been corrected, you are ready to execute your program.  Again, go to the Menu item labeled Build and choose the item tagged with an exclamation mark !, Execute First.exe.  Your output will be sent to a DOS window.

It takes some getting used to, but as usual your comfort level will improve with experience.  By the way, I don't want to discourage anyone from using another compiler (Borland, Symantec, etc.) if that is what you have access to.   However, we are constrained to use the Visual C++ development package during our lab time.

Back to CSC 076N Home Page