Setting up a Muti-file Codelite Project
The following directions discuss creating a multi-file Codelite project
when you are given source files and test data. These directions describe
setting up a new workspace for every project. This probably is not
necessary, but minimizes confusion if you have more than one project.
- Close any open workspaces. (This may not be necessary - you can
experiment if you wish.)
- From the File menu, select New Workspace. Make it
a C++ workspace and browse to a convenient location. If you are
going to put just one project in the workspace, use a project-specific
name that you will recognize later.
- From the File menu, select New Project. Set the project
name appropriately. The following assumes you leave Create the
project in its own folder checked, but you might experiment with the
other options. The remaining fields should all have their default
values: Category: Console; Type: Simple eecutable (g++); Compiler: GCC;
Debugger: GNU gdb debugger; Build System: CodeLite Makefile
Generator. Click OK.
- This creates a project with a
main.cpp
. You will
probably want to delete that code and replace it with something that uses
standard C++ libraries (instead of C libraries). For example,
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
cout << "Hello" << endl;
return0;
}
Some options for how to proceed
- To write a new file to be created for the project, open
the
File
menu and select New Empty File. To give the
file an appropriate name, save it and it will prompt for the full file
name. You will want to include the appropriate extension such
as .h
or .cpp
.
- To add existing code,
- Move the code to the folder containing your
main.cpp
- Right click on the
src
folder and select Add an
Existing File...
- Control-click to select the
.h
and .cpp
files and click Open
- You may need to select Workspace | Reload Workspace
(that is, Reload Workspace from the Workspace menu).
- To set the compiler version,
- Select Workspace | Open Active Project Settings...
- Click on Compiler
- Add -std=c++17 to the end of C++ Compiler Options
- Click OK
- You may need to select Workspace | Reload Workspace
(that is, Reload Workspace from the Workspace menu).
- To specify a file for input when the files can be opened through
command-line arguments,
- Workspace | Open Active Project Settings...
- In the General tab, click on Working Directory
- Click on the 3 dots at the end of the line to browse to the folder
containing your input files.
- Click Open
- Enter the filename in Program Arguments
- Click OK
- You may need to select Workspace | Reload Workspace
(that is, Reload Workspace from the Workspace menu).
You should now be able to use Debugger | Start/Continue
Debugger to run the debugger.