title: c++ undefined reference class constructor
body: <p>I'm trying to use a library where one of the classes has a constructor like so:</p>
  
  <pre><code>public:
  AreaNodeIndex(size_t cacheSize);
  </code></pre>
  
  <p>I'm trying to instantiate an object of this class in my program like so:</p>
  
  <pre><code>size_t const cacheSize = 50000;
  AreaNodeIndex areaNodeIndex(cacheSize);
  </code></pre>
  
  <p>The linker gives me the following error:</p>
  
  <pre><code>main.o: In function `main':
  make: Leaving directory `/home/Dev/_quicktest_build'
  main.cpp:(.text+0x212): undefined reference to  
  osmscout::AreaNodeIndex::AreaNodeIndex(unsigned int)
  </code></pre>
  
  <p>I think I have the necessary includes and I'm linking to the library with the compiler. For example, if I try to instantiate the object without any arguments on purpose I get this error:</p>
  
  <pre><code>../quicktest/main.cpp: In function ‘int main()’:
  ../quicktest/main.cpp:36: error: no matching function for call to ‘osmscout::AreaNodeIndex::AreaNodeIndex()’
  /usr/local/include/osmscout/AreaNodeIndex.h:75: note: candidates are: osmscout::AreaNodeIndex::AreaNodeIndex(size_t)
  /usr/local/include/osmscout/AreaNodeIndex.h:33: note:     osmscout::AreaNodeIndex::AreaNodeIndex(const osmscout::AreaNodeIndex&amp;)
  </code></pre>
  
  <p>So I can see the correct prototype (though here it says size_t and before it said unsigned int)...</p>
  
  <p>I can use other parts of the library fine. Here are the actual source files for the class in question:</p>
  
  <p><a href="http://libosmscout.git.sourceforge.net/git/gitweb.cgi?p=libosmscout/libosmscout;a=blob;f=libosmscout/include/osmscout/AreaNodeIndex.h" rel="nofollow">http://libosmscout.git.sourceforge.net/git/gitweb.cgi?p=libosmscout/libosmscout;a=blob;f=libosmscout/include/osmscout/AreaNodeIndex.h</a></p>
  
  <p><a href="http://libosmscout.git.sourceforge.net/git/gitweb.cgi?p=libosmscout/libosmscout;a=blob;f=libosmscout/src/osmscout/AreaNodeIndex.cpp" rel="nofollow">http://libosmscout.git.sourceforge.net/git/gitweb.cgi?p=libosmscout/libosmscout;a=blob;f=libosmscout/src/osmscout/AreaNodeIndex.cpp</a></p>
  
  <p>I'm pretty lost as to why this is happening. I feel like I've missed something obvious.</p>
  
  <p>*In response to the replies:
  The library gets size_t from "sys/types.h", so I don't think we're using different versions. The library was compiled on my system with the same compiler (g++, linux).
  Changing the 'const' specifier location has no effect.</p>
  
  <p>I am linking to the library. As I mentioned, I can use other classes from the library without issue. Here's the linking command:</p>
  
  <p>g++ -Wl,-O1 -Wl,-rpath,/home/QtSDK/Desktop/Qt/473/gcc/lib -o quicktest main.o    -L/home/QtSDK/Desktop/Qt/473/gcc/lib -losmscout -lpthread</p>
  
  <p>The library name is 'osmscout'.</p>
  
  <p>kfl</p>