Difficulty: Intermediate
Estimated Time: 10 minutes

This scenario takes you through the basics of using SCons as a build tool for your C/C++ application.

For more details see SCons V3.0.1 Docs

You will learn the following

  1. Setting Up and Testing SCons (on Ubuntu)
  2. Writing your application
  3. Building your application against SCons
  4. Profit

Building with SCons

Step 1 of 4

Step 1 - Setting Up

Setting Up SCons

We'll first download SCons v3.0.1
wget http://prdownloads.sourceforge.net/scons/scons-3.0.1.tar.gz

Then unzip the downloaded artifact into any directory tar -xzf scons-3.0.1.tar.gz

Then we'll install SCons using the following Python command cd scons-3.0.1 && python setup.py install

Let check if everything is working as expected by creating a simple application cd .. && scons -v

mkdir -p helloscons && cd helloscons

Create a simple HelloWorld app in file called app.c

touch app.c

Then add SCons config file

touch SConstruct

Then open the file under helloscons/app.c and paste the following

#include <stdio.h> 
int main() {
    printf("Hello Scons\n");
}

Also open the file helloscons/SConstruct and paste the following

Program('app.c')

Let's build

scons

And execute ./app

Let's clean that up now that we're sure SCons is working
cd .. && rm -fr helloscons

Close all open editors and move to the next exercise

This tab will not be visible to users and provides only information to help authors when creating content.

Creating Katacoda Scenarios

Thanks for creating Katacoda scenarios. This tab is designed to help you as an author have quick access the information you need when creating scenarios.

Here are some useful links to get you started.

Running Katacoda Workshops

If you are planning to use Katacoda for workshops, please contact [email protected] to arrange capacity.

Debugging Scenarios

Below is the response from any background scripts run or files uploaded. This stream can aid debugging scenarios.

If you still need assistance, please contact [email protected]