SunQuest
           MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old January 30th, 2000, 10:43 AM
Astro Astro is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Location: Cleveland, OH, USA
Posts: 8 Astro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Astro
Hopefully this is just a really silly question:

I can't figure out where the MySQL library is at!

I'm using Linux RH 5.2 & MySQL installed by using the source RPM and doing rpm --rebuild [mysql.rpm]. I've done some quick tests and verified mysqld is working ok.

I found the include files:

/var/tmp/mysql/usr/include/mysql/mysql.h

The test program I wrote:

#include <stdio.h>
#include <sys/time.h>
#include </var/tmp/mysql/usr/include/mysql/mysql.h>

void main()
{
MYSQL_RES *result;
MYSQL_ROW row;
MYSQL *connection, mysql;
int state;

mysql_init(&mysql);

printf("Done.");
} // end void main()

I compile using g++:
/tmp/cca057881.o: In function `main':
/tmp/cca057881.o(.text+0x11): undefined reference to `mysql_init'
collect2: ld returned 1 exit status

If I compile under gcc I get the same error. I beleive this is because g++/gcc don't know where the libraries are at (and neither do I!)

Ideas?

Astro

Reply With Quote
  #2  
Old January 31st, 2000, 01:31 PM
Kyuzo Kyuzo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 1999
Location: Annapolis, Maryland US
Posts: 113 Kyuzo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Try changing the third include directive back to #include <mysql.h> and use the -I, -L and -lmysqlclient switches when compiling and linking

gcc -c -I/var/tmp/mysql/usr/include/mysql program.c

then

gcc -o program program.o -L/var/tmp/mysql/usr/lib/mysql -lmysqlclient

..or wherever the header files and client library are located

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > C/C++ w/MySQL [linux]


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway