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

Quick Reply

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it has been approved by a moderator.

Please leave this box empty:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

Shortcuts: ALT+S post or ALT+P preview