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)

Workspace


Workspace in Code::Blocks is a collection of projects. Workspace acts as a container of projects and also maintains project dependencies. So if project 2 is dependent upon project 1, then project 2 will be compiled before compilation of project 1.

Consider the following snippets. Create a static library project named libcalc by navigating to File | New | Project… and select Static library wizard.

Then replace code of project's main.c file with the following code:

int mult(int a, int b)
{
    return (a * b);
}

Next create a console project named App6 and then replace its main.cpp file with the following code:

#include <iostream>

extern "C" int mult(int a, int b);

int main() {
    std::cout << "2 * 3 = " << mult(2, 3);
    return 0;
}

The Management window now shows two projects in one workspace. Workspace has been renamed to App6 in the following screenshot:

This workspace can be saved by navigating to File | Save workspace as… menu option. Right-click on the App6 project...