title: Library of functions without classes
body: <p>How might one setup a library of functions for use by importing a file. I know you can make a class that is just static variables but there should be a way to do it without classes. What I've tried is this:</p>
  
  <p>lib.h:</p>
  
  <pre><code>  1 #include &lt;cstdio&gt;
    2 
    3 namespace el {
    4 
    5 int add(int a, int b);
    6 
    7 }
  </code></pre>
  
  <p>lib.cpp:</p>
  
  <pre><code>  1 #include &lt;cstdio&gt;
    2 #include "lib.h"
    3 
    4 using namespace std;
    5 using namespace el;
    6 
    7 int add(int a, int b) {
    8         return a + b;
    9 }
  </code></pre>
  
  <p>main.cpp:</p>
  
  <pre><code>  1 #include &lt;cstdio&gt;
    2 #include "lib.h"
    3 
    4 using namespace std;
    5 using namespace el;
    6 
    7 int main() {
    8         printf("%d\n", add(1, 2));
    9 
   10         return 0;
   11 }
  </code></pre>
  
  <p>I am not sure what is wrong with this implementation but what I get is an <code>Undefined symbols for architecture</code> error on the add function.</p>