News: - Used by 85,000 Members - SMS Backed up 7,35,000 - Contacts Stored  28,850 !!

Main Menu

Compiling and Running a Program

Started by sukishan, Aug 13, 2009, 12:49 PM

Previous topic - Next topic


Once you have created a project and its associated C++ source and header file(s), you are ready to compile. Actually, the best choice is often Rebuild All, found under the Build menu item.

The Compile option would only handle a project with a single source file. Rebuild All will see that everything is recompiled, linked, etc. For a project with multiple source files, the Build option under the Build menu is smart enough only to recompile files that must be recompiled due to changes made since the last time you compiled. Thus, Build is usually faster than Rebuild All in such cases.

Error messages will normally be shown in a small Build window at the bottom of the screen. Of course, you can enlarge this window by placing the mouse on the dividing line between this window and the one above and dragging it.

If this window is not shown at all, try clicking on the Output button in the middle of the toolbar. (If you unsure which button this is, place your mouse pointer over each button for a while until the descriptive label is shown.) Double clicking on an error message should take you to the spot in the program where the error occurred.

To run your program, either click on the button with the red exclamation point, or select Build, Execute. Since we are creating console applications, the programs run in a DOS window showing all input and output. (Hint: If you get an error message about WinMain, that means that you did not set up your project to be a console application. Make a new project of the correct type and add your files to it.)
A good beginning makes a good ending