title: C++: Undefined reference to function in namespace
body: <p>Here I am, trying to figure out what's wrong with my code without success :(
  I'm writing a resampler but I guess that's of no interest at all, I'm just trying yo make this stupid warning go away. Anyway, here's my code:</p>
  
  <p><strong>ddc.hpp</strong></p>
  
  <pre><code>#ifndef __DIGITAL_DOWN_CONVERTER_H__
  #define __DIGITAL_DOWN_CONVERTER_H__
  
  #include &lt;vector&gt;
  #include "interpolator.h"
  
  namespace ddc {
      void decimate(std::vector&lt;float&gt; &amp;, unsigned int);
      void expand(std::vector&lt;float&gt; &amp;, unsigned int);
      void perform_resampling(std::vector&lt;float&gt;, unsigned int, unsigned int);
      void generate_filter(std::vector&lt;float&gt; &amp;, unsigned int, unsigned int);
      float Sinc(float);
      unsigned int mcd(unsigned int, unsigned int);
  }
  
  #endif
  </code></pre>
  
  <p><strong>ddc.cpp</strong></p>
  
  <pre><code>#include "ddc.hpp"
  
  namespace ddc {
      void perform_resampling(std::vector&lt;float&gt; &amp;data, unsigned int freq_1, unsigned int freq_2) {
          unsigned int i, gcd = mcd(freq_1, freq_2);
          unsigned int downFactor, upFactor;
          std::vector&lt;float&gt; filter;
  
          downFactor = freq_1/gcd;
          upFactor   = freq_2/gcd;
  
          generate_filter(filter, 1024 /* lobi della semi-sinc */, upFactor);
  
          decimate(data, downFactor);
          expand(data, upFactor);
          interpolate_fft(data, filter);
      }
  }
  </code></pre>
  
  <p><strong>main.cpp</strong></p>
  
  <pre><code>#include &lt;vector&gt;
  #include "ddc.hpp"
  
  using namespace std;
  
  int main() {
      vector&lt;float&gt; data;
      // bla bla
  
      ddc::perform_resampling(data, 1000000, 60000);
      return 0;
  }
  </code></pre>
  
  <p>Compiling with g++ (linux) I get the following error:</p>
  
  <pre><code>$ make all
  g++ -c ddc.cpp -o ddc.o -Wall -O3 -lm -m64
  g++ -c main.cpp -o main.o -Wall -O3 -lm -m64
  g++ ddc.o main.o -o ../bin/resampler
  main.o: In function `main':
  main.cpp:(.text.startup+0x255): undefine d reference to
  `ddc::perform_resampling(std::vector&lt;float, std::allocator&lt;float&gt; &gt;, unsigned int, unsigned int)'
  collect2: ld returned 1 exit status
  make: *** [../bin/resampler] Error 1
  </code></pre>
  
  <p>I'm going out of my mind, please help me! What am I doing wrong? Besides, If I remove <code>ddc::</code> from the main function, gcc suggests me this:</p>
  
  <pre><code>main.cpp:59:49: note: suggested alternative:
  ddc.hpp:24:7: note:   ‘ddc::perform_resampling’
  </code></pre>