Page 1#

Source#

This is a test for the literate programming sphinx extension developped for this guide.

#include <iostream>

{{Includes}}

int main(int, char**) {
    {{Main content}}
}

Before anything, let’s talk about the return value:

Main return#
return EXIT_SUCCESS;

Note that this requires to include the cstdlib header:

#include <cstdlib>

Then we can focus on the core content:

std::cout << "Hello world" << std::endl;
{{Main return}}
project(Example)
add_executable(
    App
    {{Source files}}
)
src/main.cpp

Tangled result#

Tangled block 'file: src/main.cpp' [from here]

#include <iostream>

#include <cstdlib>

int main(int, char**) {
    std::cout << "Hello world" << std::endl;
    return EXIT_SUCCESS;
}

Tangled block 'file: CMakeLists.txt' [from here]

project(Example)
add_executable(
    App
    src/main.cpp
)