Book Image

C++ Application Development with Code::Blocks

By : BIPLAB MODAK
Book Image

C++ Application Development with Code::Blocks

By: BIPLAB MODAK

Overview of this book

Table of Contents (13 chapters)

Creating your first app with Code::Blocks


Let's write a simple Hello World app, which essentially prints out "Hello World" to console. Launch Code::Blocks to begin and as shown in the following screenshot click on the new button in main toolbar and then click on the File menu option. The following screenshot represents the same:

Click on the C/C++ source option in the next window and then on the Go button. A wizard will be presented. Click on the Next button on the first page of the wizard. Choose the C++ option and click on the Next button. Choose file path and name in the next window and click on the Finish button to complete wizard.

Then type the following code in the editor:

#include <iostream>

int main() {
  std::cout << "Hello World!" << std::endl;
  return 0;
}

Code::Blocks will automatically add an empty line at the end of the file if there isn't any, this is a Code::Blocks feature. GCC expects an empty line at the end of source code, and it will throw warning if an...