Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8668661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:16:07+00:00 2026-06-12T18:16:07+00:00

I want to connect to a mysql database with C++ in linux. On my

  • 0

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:

sudo apt-get install mysql-server mysql-client

I came across Mysql++ but have some problems when running ./configure from their binary package. The error says:

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’

I see where I can use this command to specify the path:

./configure –with-mysql-lib=/…

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?


EDIT:

After doing locate libmysqlclient I got back

/usr/lib/i386-linux-gnu/libmysqlclient.so.18
/usr/lib/i386-linux-gnu/libmysqlclient.so.18.0.0
/usr/lib/i386-linux-gnu/libmysqlclient_r.so.18
/usr/lib/i386-linux-gnu/libmysqlclient_r.so.18.0.0
/usr/share/doc/libmysqlclient18
/usr/share/doc/libmysqlclient18/changelog.Debian.gz
/usr/share/doc/libmysqlclient18/copyright
/var/cache/apt/archives/libmysqlclient18_5.5.22-0ubuntu1_i386.deb
/var/lib/dpkg/info/libmysqlclient18:i386.list
/var/lib/dpkg/info/libmysqlclient18:i386.md5sums
/var/lib/dpkg/info/libmysqlclient18:i386.postinst
/var/lib/dpkg/info/libmysqlclient18:i386.postrm
/var/lib/dpkg/info/libmysqlclient18:i386.shlibs

So, I tried ./configure --with-mysql-lib=/usr/lib/i386-linux-gnu and it seems to complete without any complaining.

Although this solves the problem of getting ./configure to complete, I still have further troubles. When I run make things go fine until this point:

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&)’: ./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&)’: ./lib/refcounted.h:246:13: error: ‘refs_’ was
not declared in this scope make: *** [mysqlpp_sql_buffer.o] Error 1

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T18:16:09+00:00Added an answer on June 12, 2026 at 6:16 pm

    this problem is caused because size_t depends on the inclusion of stddef namespace before it is called in the configuration (make) files.

    i had the very same problem (using an amazon EC2 ubuntu 12.04 cloud server) and solved it by editing the offending file (sql_buffer.cpp located, in my case, /home/ubuntu/mysql++-3.1.0/lib) and including stddef (while also moving string namespace up):

    #include <stddef.h>
    #include <string.h>
    #include "sql_buffer.h"
    

    your question is answered with this correction. BUT, you might have additional problems, like i did. so i explain how i solved some subsequent problems, which you might or might not have also.

    you might have to use

    sudo chown username sql_buffer.cpp
    

    to be able to edit the file, depending on how your install is setup (i am user ubuntu, for example).

    i then bumped into another problem:

    ./ssx/genv2.cpp: In function âbool generate_ssqls2(const char*, const ParseV2*)â:
    ./ssx/genv2.cpp:70:28: error: âstrcmpâ was not declared in this scope
    

    so i edited the offending file (genv2.cpp) and included string namespace

    #include <string.h>
    

    then i had ANOTHER problem with:

    ./libmysqlpp_ssqls2parse.a(ssqls2parse_parsev2.o): In function `Type':
    /home/ubuntu/mysql++-3.1.0/./ssx/parsev2.cpp:256: undefined reference to `mysqlpp::internal::str_to_lwr
    

    i could have edited Makefile.in but chose to simply run in command line:

    sudo  g++ -o test_ssqls2 test_ssqls2_ssqls2.o -lmysqlpp_ssqls2parse   -L. -lmysqlclient   -L/usr/lib/x86_64-linux-gnu  -lmysqlpp
    

    i then continued the make process.

    that worked for me: mysql++ installed and running.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to connect to a MySQL database that is installed on a linux
I want to connect to a MySQL server database from an android client. I
I'm using JSP and I want to connect to a local mySQL database thorough
I want to connect a MySQL database with Visual Studio 2010 server explorer so
I've got a locally installed MySQL database server that I want to use for
I want to connect to a MySQL database from a c++ program. I've installed
I've just made a database on mysql on my server. I want to connect
I want to connect trough SSH channel to mysql database on the server. I
So the scenario is this: I have a mySQL database on a local server
if've got three tables in my MYSQL Database and want to connect two of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.