Easy to use mysql library/header?

Red Squirrel

No Lifer
May 24, 2003
71,309
14,083
126
www.anyf.ca
I've tried mysql++ and now looking at mysql connector/c++

Both are very hard to get working, and the number and type of problems vary from distro to distro. It usualy takes a few days to actually get a program to compile using it due to the fact that it depends too much on the system.

I've been trying to code my own but I'm not finding enough full detailed explainations of the protocol online, so it's proving to be a challenge.

Anyone know of a mysql library that simply consists of a .h file I include in my project? I just want something really easy so I can actually start coding right away and not have to worry about system differences, and linking libraries, installing dependencies, and all that crap. I've thought of just making it use the built in client and parse out the output but that's kind of dirty.
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
apt-get install libmysql++-dev is all you need in a Debian distro to get them working. I have a hard time believing it is much harder in CentOS.

edit:...

FWIW have you actually tried to troubleshoot your problems? What error messages are you getting, you always just say something doesn't work without giving any details of what you did try or what the error messages are. Instead of trying to work around your problems you need to work through them.
 

Red Squirrel

No Lifer
May 24, 2003
71,309
14,083
126
www.anyf.ca
I just get tons of link errors and stuff when I try. It's always different problems on every distro. Like for some distro I need to add a symlink somewhere, other distros it's not even worth trying to fix. (thousands of link errors and crap). It's just too much work. I want to get coding, not spend hours troubleshooting why the library wont work.
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
That's why you need to use autoconf. There are tools to help with your exact specific issues.
 

Red Squirrel

No Lifer
May 24, 2003
71,309
14,083
126
www.anyf.ca
Isin't make files for installers? I don't want to "install" my application, I want to compile it. "./configure" and stuff installs it right into the system. I don't want to do that, I want all the sources/files/binary to be in the same location. I've seen make/.configure scripts fail quite often too, so I have a feeling whatever errors I get with mysql++ I would get with that system too.

I'm trying to keep my dev proceedure as simple as possible so it's easy to take the whole folder, drop it on another system, and compile/run it.
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
Wrong wrong wrong. A make file is for MAKING your application, therefore it is going to compile it for you. If you so choose, you can include an install option with your Makefile to install the your compiled files in the right place.

./configure will configure your build environment to match what you need in your particular environment and then make will use the Makefile generated by ./configure to compile your application. What you do from that point on is your choice, you can run it from your local directory if you want or you can install it to a system directory like /usr/bin or /opt
 

Red Squirrel

No Lifer
May 24, 2003
71,309
14,083
126
www.anyf.ca
Hmm that I did not know. I'll have to read up on how to generate make/configure files. Not finding much though.

I managed to get mysql++ working. I had to change the compile string from this:

g++ -o sqltest sqltest.cpp -lmysqlpp -L/usr/lib/mysql -lmysqlclient -I/usr/local/include/mysql++/ -I/usr/include/mysql

To this:

g++ -o sqltest sqltest.cpp -lmysqlpp -L/usr/lib64/mysql -lmysqlclient -I/usr/local/include/mysql++/ -I/usr/include/mysql

To reflect the fact that I'm compiling in a 64-bit OS. I also had to reinstall most programs including mysql itself. A pain. I'm actually scared to see the trouble I'll get when I move this app to my production box.