1. Home
  2. Computing & Technology
  3. C / C++ / C#

How to Compile Programs with Microsoft Visual C++ 6

By , About.com Guide

3 of 8

Compiling With Visual C++ 6

Compiling the Hello World Application

This is what the generated example1.cpp looks like.
// ex1.cpp : Defines the entry point for the Command Line application.
//

#include "stdafx.h"

int main(int argc, char* argv[])
{
printf("Hello World!\n") ;
return 0;
}

This is standard C++ file. In fact it's also a standard C as well though it defaults to cpp. You can mix cpp and c files but don't give them the same name as the compiler will expect to compile both example1.c and example1.cpp into example1.obj and it will object to having two files generate the same object file.

To remove files from the Project, just select each in the tree and press delete. To add a file right click on "Source Files" (for .cpp, or .c) or "Header Files" for .h and click "add files to Folder". This will open a window so you can browse to your file, select and add it.

Click on the Project name in the Workspace tree and press the F7 key. That will Make the Hello World application. You can run it by pressing F5 but you won't see much, as it's a console application and the window will open and close very quickly.

You need to get to the command line (Click the Start button, then click Run, type cmd and press enter) and navigate to the folder where the project files are located. After compiling, a debug folder is created there and this contains the debug executable which you can run.

On the next page : Learn how to switch between Debug and Release versions.

Explore C / C++ / C#
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. C / C++ / C#
  4. C
  5. C Tutorials
  6. Compiling With Visual C++ 6

©2009 About.com, a part of The New York Times Company.

All rights reserved.