user60405: I have created a library of functions that doesn't have and mustn't have a class. In order to have functions inside the library that can only be called from the library itself, you just write them into the .cpp file and leave them out of the header file completely. Here is the .cpp file of the library (the header file is empty):
#include "Lib.h"

// Definition of foo1
static void foo1(){
    foo2();
}

// Definition of foo2
static void foo2() {}

When including the library in an empty sketch and compiling it I get the following error message:

error: 'foo2' was not declared in this scope

What is the problem here?

user60405: When creating a library with functions that are not mentioned in the header file, the order of appearence in the .cpp file suddenly becomes relevant. In order for a function to be used by another function, it has to be declared first.
The first possibility in this example would be to define foo2 before defining foo1 like this:
#include "Lib.h"

// Definition of foo2
static void foo2() {}

// Definition of foo1
static void foo1(){
    foo2();
}

However, this is not only bad practice, it also doesn't always work. If there is any sort of recursive procedure that makes functions call each other, you can't define both of them before the respective other at the same time.
The more elegant and foolproof way to do this is by declaring each function first like you usually would in the header file and then defining what they actually do. The .cpp file of this library would then look like this:
#include "Lib.h"

static void foo1(); // Declaration of foo1
static void foo2(); // Declaration of foo2

// Definition of foo1
void foo1(){
    foo2();
}

// Definition of foo2
void foo2() {}


60405: <p>I have created a library of functions that doesn't have and mustn't have a class. In order to have functions inside the library that can only be called from the library itself, you just write them into the .cpp file and leave them out of the header file completely. Here is the .cpp file of the library (the header file is empty):</p>

<pre class="lang-cpp prettyprint-override"><code>#include "Lib.h"

// Definition of foo1
static void foo1(){
    foo2();
}

// Definition of foo2
static void foo2() {}
</code></pre>

<p>When including the library in an empty sketch and compiling it I get the following error message:</p>

<blockquote>
  <p>error: 'foo2' was not declared in this scope</p>
</blockquote>

<p>What is the problem here?</p>
 60405: <p>When creating a library with functions that are not mentioned in the header file, the order of appearence in the .cpp file suddenly becomes relevant. In order for a function to be used by another function, it has to be declared first.</p>

<p>The first possibility in this example would be to define <code>foo2</code> before defining <code>foo1</code> like this:</p>

<pre class="lang-cpp prettyprint-override"><code>#include "Lib.h"

// Definition of foo2
static void foo2() {}

// Definition of foo1
static void foo1(){
    foo2();
}
</code></pre>

<p>However, this is not only bad practice, it also doesn't always work. If there is any sort of recursive procedure that makes functions call each other, you can't define both of them before the respective other at the same time.</p>

<p>The more elegant and foolproof way to do this is by <strong>declaring</strong> each function first like you usually would in the header file and then defining what they actually do. The .cpp file of this library would then look like this:</p>

<pre class="lang-cpp prettyprint-override"><code>#include "Lib.h"

static void foo1(); // Declaration of foo1
static void foo2(); // Declaration of foo2

// Definition of foo1
void foo1(){
    foo2();
}

// Definition of foo2
void foo2() {}
</code></pre>
