title: Setting up Mysql++ in linux
body: <p>I want to connect to a mysql database with C++ in linux.  On my local machine I am running Ubuntu, and installed the mysql server and client packages:</p>
  
  <blockquote>
    <p>sudo apt-get install mysql-server mysql-client</p>
  </blockquote>
  
  <p>I came across <a href="http://tangentsoft.net/mysql++/" rel="noreferrer">Mysql++</a> but have some problems when running ./configure from their binary package.  The error says:</p>
  
  <blockquote>
    <p>checking for MySQL library directory... configure: error: Didn't find mysqlclient library in '/usr/lib64 /usr/lib /usr/lib64/mysql /usr/lib/mysql /usr/local/lib64 /usr/local/lib /usr/local/lib/mysql /usr/local/mysql/lib /usr/local/mysql/lib/mysql /usr/mysql/lib/mysql /opt/mysql/lib /opt/mysql/lib/mysql /sw/lib /sw/lib/mysql'</p>
  </blockquote>
  
  <p>I see where I can use this command to specify the path:</p>
  
  <blockquote>
    <p>./configure --with-mysql-lib=/...</p>
  </blockquote>
  
  <p><strike>but I do not know where to point it to.  I used whereis mysql but cannot find any mysql directory that contains a lib subdirectory.   Where would the mysqlclient libraries be installed?</strike></p>
  
  <hr>
  
  <p>EDIT:</p>
  
  <p>After doing locate <code>libmysqlclient</code> I got back</p>
  
  <blockquote>
    <p>/usr/lib/i386-linux-gnu/libmysqlclient.so.18<br>
    /usr/lib/i386-linux-gnu/libmysqlclient.so.18.0.0<br>
    /usr/lib/i386-linux-gnu/libmysqlclient_r.so.18<br>
    /usr/lib/i386-linux-gnu/libmysqlclient_r.so.18.0.0<br>
    /usr/share/doc/libmysqlclient18<br>
    /usr/share/doc/libmysqlclient18/changelog.Debian.gz<br>
    /usr/share/doc/libmysqlclient18/copyright<br>
    /var/cache/apt/archives/libmysqlclient18_5.5.22-0ubuntu1_i386.deb<br>
    /var/lib/dpkg/info/libmysqlclient18:i386.list<br>
    /var/lib/dpkg/info/libmysqlclient18:i386.md5sums<br>
    /var/lib/dpkg/info/libmysqlclient18:i386.postinst<br>
    /var/lib/dpkg/info/libmysqlclient18:i386.postrm<br>
    /var/lib/dpkg/info/libmysqlclient18:i386.shlibs  </p>
  </blockquote>
  
  <p>So, I tried <code>./configure --with-mysql-lib=/usr/lib/i386-linux-gnu</code>  and it seems to complete without any complaining.</p>
  
  <p>Although this solves the problem of getting ./configure to complete, I still have further troubles.  When I run <code>make</code> things go fine until this point:</p>
  
  <blockquote>
    <p>In file included from ./lib/sql_buffer.h:31:0,
                     from ./lib/sql_buffer.cpp:26: ./lib/refcounted.h:258:2: error: ‘size_t’ does not name a type
    ./lib/refcounted.h: In constructor ‘mysqlpp::RefCountedPointer::RefCountedPointer()’: ./lib/refcounted.h:89:2: error:
    class ‘mysqlpp::RefCountedPointer’ does not have any
    field named ‘refs_’ ./lib/refcounted.h: In constructor
    ‘mysqlpp::RefCountedPointer::RefCountedPointer(T*)’:
    ./lib/refcounted.h:100:2: error: class ‘mysqlpp::RefCountedPointer’ does not have any field named ‘refs_’
    ./lib/refcounted.h:104:4: error: ‘refs_’ was not declared in this
    scope ./lib/refcounted.h:104:16: error: expected type-specifier before
    ‘size_t’ ./lib/refcounted.h:104:16: error: expected ‘;’ before
    ‘size_t’ ./lib/refcounted.h: In constructor
    ‘mysqlpp::RefCountedPointer::RefCountedPointer(const
    ThisType&amp;)’: ./lib/refcounted.h:112:2: error: class
    ‘mysqlpp::RefCountedPointer’ does not have any field
    named ‘refs_’ ./lib/refcounted.h:115:8: error: ‘refs_’ was not
    declared in this scope ./lib/refcounted.h: In destructor
    ‘mysqlpp::RefCountedPointer::~RefCountedPointer()’:
    ./lib/refcounted.h:125:7: error: ‘refs_’ was not declared in this
    scope ./lib/refcounted.h: In member function ‘void
    mysqlpp::RefCountedPointer::swap(mysqlpp::RefCountedPointer::ThisType&amp;)’: ./lib/refcounted.h:246:13: error: ‘refs_’ was
    not declared in this scope make: *** [mysqlpp_sql_buffer.o] Error 1</p>
  </blockquote>
  
  <p>I'm not really familiar with C++, so I'm not sure what the error means exactly.  Any help or direction on how to get Mysql++ setup from this point would be much appreciated.  Although, I admit that I'm also starting to look for alternative libraries to use.</p>