Home Forums Gamescan Chat42 About
* Login   * Register * FAQ    * Search
It is currently Thu 05-16-2024 10:21AM

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Help with MySQL++
PostPosted: Fri 09-15-2006 4:50PM 
Offline
Lieutenant
User avatar

Joined: Wed 03-03-2004 11:59AM
Posts: 85

Source: Fidelity
Does anyone have any experience using MySQL++? It's a wrapper for MySQL commands for use in C++. I can't seem to get them to work on my Ubuntu 6.06 box. Are there any tricks to setting them up? I used apt-get and it claims they are installed, but my program can't seem to find the libraries during compile time. My first thought was that the correct directories were not being included, but I double checked the locations and they have the mysql.h files and the libraries. Any help or comments would be appreciated.

_________________
Nobody expects the Spanish inquisition!


Top
 Profile  
    
 Post subject:
PostPosted: Fri 09-15-2006 5:16PM 
Offline
Spanish
User avatar

Joined: Wed 08-21-2002 10:10AM
Posts: 1898
Location: A-Frames bitches!

Source: Off Campus
i'm assumming you're using g++ or something. You want to add the flags:

Code:
-L/directory/where/the/library/is -lnameoflib


so if your library is libmysql.so and it's in /usr/local/lib, you'll want to add

Code:
-L/usr/local/lib -lmysql


Also dont forget to add the proper -I flags to help find the .h files

_________________
KOK - 011, Pullin rank on bitches since 2005


Top
 Profile E-mail  
    
 Post subject:
PostPosted: Fri 09-15-2006 11:54PM 
Offline
Colonel
User avatar

Joined: Sun 08-18-2002 10:33AM
Posts: 750
Location: Kansas City, KS

Source: Off Campus
If you're just farting around with 'pure' SQL, you might want to look into SQLite.

_________________
It is by caffeine alone I set my mind in motion.
It is by the beans of Java the thoughts acquire speed,
the hands acquire shaking, the shaking becomes a warning.
It is by caffeine alone I set my mind in motion.


Top
 Profile E-mail  
    
 Post subject:
PostPosted: Sun 09-17-2006 8:07PM 
Offline
Brigadier General

Joined: Tue 01-22-2002 12:35PM
Posts: 1057
Location: Shawnee Mission, KS

Source: Off Campus
I know Red Hat is retarded in that you could have the lib<whatever> package installed but when you go to include code from it, the compiler complains. What you really needed was the lib<whatever>-dev package. I've run into this a couple of times with Ubuntu as well. So try

apt-cache search (name of library)

and see if there's a (name of library)-dev package, then

apt-get install (name of library)-dev

or whatever to get that one.


Why you would install a lib package and not want to include/link to it escapes me, but that's what they do.


Top
 Profile E-mail  
    
 Post subject:
PostPosted: Sun 09-17-2006 9:34PM 
Offline
Lieutenant
User avatar

Joined: Wed 03-03-2004 11:59AM
Posts: 85

Source: Fidelity
Thanks for the tips, but the program still won't compile. Using sqlite or something like that isn't an option, as I am using code that was given to me for a project. My actual error now during compile time is an undefined reference to mysqlpp::Connection::Connection(bool), when I am attempting to create an object that could connect to the database. I checked and I have the -dev packages. Everything should be calling correctly since I am am trying to compile a test program based on the example from the mysql++ website.

_________________
Nobody expects the Spanish inquisition!


Top
 Profile  
    
 Post subject:
PostPosted: Mon 09-18-2006 8:23PM 
Offline
Sergeant

Joined: Sun 03-09-2003 9:34PM
Posts: 47

Source: Fidelity
1) Double / Triple check paths and the -l. ( I.e. -lmysqlpp)
2) I believe that the order the libraries are listed in is significant.
I.e. if you have: -llibMyLib -lm -lthread -lmysqlpp
linking may fail, but it might work with: -lmysqlpp -llibMyLib -lm -lthread

http://docs.hp.com/en/B2355-90655/ch02s06.html

Quote:
The linker searches libraries in the order in which they are specified on the command line — the link order. Link order is important in that a library containing an external reference to another library must precede the library containing the definition. This is why libc is typically the last library specified on the linker command line: because the other libraries preceding it in the link order often contain references to libc routines and so must precede it.


Bill


Last edited by bsiever on Mon 09-18-2006 8:38PM, edited 2 times in total.

Top
 Profile E-mail  
    
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group