**EDIT: The problem is the forgotten include guard. Sorry!**

So I'm trying to consequently apply two file rule where all declarations go into a ***.hpp*** file and all definitions into the corresponding **.cpp** file. My problem are global functions in libraries whose header gets included in multiple locations.  

**For example:**

```
/* lib1.hpp */
namespace lib1{
int addNumbers(int a, int b);
}

```

and the cpp file:

```
/* lib1.cpp */
namespace lib1{
int addNumbers(int a, int b) {return a + b;}
}

```

Now if I include **lib1.hpp** in multiple libraries, say **lib2**, **lib3** and then include both, **lib2** and **lib3** in any other library or executable-file, 

> 
> I get the *multiple definitions of addNumbers()* error.
> 
> 
> 

This makes sense to me, but I can't figure out how to solve this issue. I tried the `extern` keyword, but it doesn't change anything:

```
/* lib1.hpp */
namespace lib1{
extern int addNumbers(int a, int b);
}

```

and the cpp file remains the same:

```
/* lib1.cpp */
#include "lib1.hpp"

namespace lib1{
int addNumbers(int a, int b) {return a + b;}
}

```

It would work if I created a surrounding class for the functions in **lib1.hpp**, but that doesn't help me understand the problem and adds a redundant namespace like `lib1::lib1::addNumbers()` for instance.