How to Configure CodeLite to Compile and Run C++ Programs


In this article, we show how to configure CodeLite to compile and run C++ programs.

So in order to use CodeLite successfully, you have to know how to set it up to build and run programs without error.

We will show all the steps below of how to set up CodeLite to be able to execute C++ programs.

So the first step in the process is to create a New Workspace.

The Workspace is kind of like the folder that holds all the projects folders of a given coding program.

So you have your general workspace and then you have all the projects folders in that workspace that you will use for a coding program.

So go to the Menu bar where you see 'Workspace' and click on the button; a drop-down menu will appear. There you click on 'New Workspace'.

This is shown below.

Creating a new workspace in CodeLite

So now a new window will pop up. Here in this window, you have to specify the workspace path (which folder the workspace will be in) and the name of the workspace.

Below, I save my workspace in the C++programs folder and as the name, Workspace1.

Specifying a workspace path and name in CodeLite

Now that you have a workspace, it is time to create a project. We create a project by right clicking on the Workspace and clicking 'New Project'.

This is shown below.

Creating a new project in a workspace in CodeLite

Once you've clicked 'New Project', then you need to go through the process of setting up the Project.

Below is the settings that you should set the project to in order for compilation and execution to work.

Setting up a new project in CodeLite

If the operating system you are using is Windows, for the debugger, you need to select 'GNU gdb debugger'. If the operating system you are using is a Mac, you need to select is 'LLDB debugger'.

These options give all the correct selections that you need to compile and run C++ programs in CodeLite.

Once you press 'OK', then the project will be created. You will see that there is a main.cpp file in the folder. Erase the contents in this main.cpp file and put in any basic C++ program.

An example main.cpp is shown below.

This project outputs "Hello".

Save and 'Build and Run' this program.

This is shown below.

Bulding and running a project in CodeLite

Now after building and running the project, you should get its output, which is "Hello".

And this is how to configure CodeLite to compile and run a C++ program.

Related Resources

C++ Hello World Program

HTML Comment Box is loading comments...