How do I use A Compiler?

There are numerous compilers available for C++ programming. One of the easiest compilers to use is the Bloodshed Dev compiler. This page will give you the information necessary to help you make your first program with that compiler.



You should already have downloaded Bloodshed Dev version 4.0. After you have installed the compiler, you should go to Start:Programs:Dev-C++ and run Dev-C++. You may be asked whether you wish Windows to associate .c and .cpp files with the compiler; you should check Yes. After the program opens, go to File-New Project...; click on it. Select Console Application, and click ok. Enter a project name when prompted; enter the filename for your project. Dev-C++ will conveniently open a new file for editing, and this file will already contain the barebones of a C++ program. Delete what is shown in that file and enter the following:
#include <iostream.h>
int main()
{
  cout<<"The Compiler Works";
  return 0;
}
To run this program, go to Execute-Run. You may be prompted to save your file; type a filename to save it. It will then execute the code you typed in. You probably won't see anything appear on the screen, although you might notice a brief flash of a DOS window. If you wish to force the compiler to leave that window open, go here. Keep in mind, when you create a finished program, you won't have a need to force the compiler to keep the window open, so you can remove the code to keep it open.

How do I make an executable file?

With Dev-C++, to make an executable file is as simple as going to Execute-Compile. You might be prompted to save your file; save it. You will then find a .exe file with the same name as the .cpp file in your My Documents folder; this .exe file is the finished program that you have created.