Skip to main content
GameDev.net gamedev.net
🔒 Locked

[web] MySQL C++ API

Started by levjs May 16, 2006 at 9:38 AM 8 replies 1.1k views
Original Post
levjs
levjs
Hi, I'm looking for a C++ API for MySQL. I have tried mysql++, but when I try to build, it needs a file mysql.h, and that file is nowhere. Even the examples provided don't work. I've googled for an answer to the problem quite considerably, but to no avail. Anyway, does anyone have an answer to the problem or a new API? Thanks alot. Levi
Sander
Sander
You can probabely download the mysql.h file from the same place as you downloaded the library/dll for MySQL server. Check the MySQL website. If you're running Linux, install the relevant -dev package for mysql (e.g. libmysqlclient14-dev)
markr
markr
The C API can be used from C++.

In any case, if you want to use the C++ one (is it officially supported?), it is almost certainly a wrapper for the C one, so you have to have its headers and link its libs anyway.

Mark
levjs
levjs
So basically, I need to install mysql on my computer, correct? : ) If that's all, I'm happy, but is that right??
Levi
Palidine
Palidine
Quote:
Original post by levjs
So basically, I need to install mysql on my computer, correct? : ) If that's all, I'm happy, but is that right??
Levi


no. i mean you can compile the app without installing mysql. You're obviously not going to be able to run it without a mysql database running.

The mysql++ API has a mysql++.h which is probably what you need. Your compiler shouldn't be complaining about missing a specific .h file. It can't possibly know what .h file to include. Are you trying to compile the mysql++ libraries or something? the download from mysql.com has the libraries already compiled. Just #include the appropriate header files and just compile your application and you should be good to go.

-me
levjs
levjs
Ok, here's what I'm doing. I downloaded mysql++ source from http://www.tangentsoft.net/mysql++/
then I'm including the mysql++.h file in my programs, and when I compile, it says it can't find mysql.h(another file that mysql++.h file includes asks mysql.h to be included).

Am I doing something wrong?
Thanks so much.
Levi
Palidine
Palidine
Yeah so here's my guess from reading the docs and such. mysql++ is tauted as a "wrapper" for the mysql C-API. So... If you want to use the C++ wrapper for the C-API you need to first download the C API and compile those libs. Then you'll need to compile the mysql++ libs and then you should be good to go.

Honestly, I'd just stick with the C API. I've used that quite happily within a C++ application and never had any troubles.

I believe that the C API comes with the default install of mysql. If not just browse around on the horribly organised mysql.com

-me
JRavey
JRavey
I realize it's redundant at this point, but I've found the C API to be wholly adequate for my needs as well.
屋根を固定するために何パンケーキそれは取るか。紫色、ヘビに足がないばい。
levjs
levjs
Yes, so have I now that I've tried it out. I'm not using the C++ API at all. It's good to have that information out there somewhere on the internet for other people as well.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.