LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-10-2004, 04:14 AM   #1
sonika_singhi
Member
 
Registered: Oct 2004
Location: india
Distribution: fedora core
Posts: 34

Rep: Reputation: 15
Unhappy accessing mysql database through c


how to compile a c program accessing mysql database.
what is the need to pass path of library files with gcc cmd while compiling.how to run the file? we have written whole c prog with necessary functions, but don't know how to run. ./a.out doesn't work.
hoping for reply,
please help!
 
Old 12-10-2004, 11:27 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Did you try:

gcc -lmysqlclient -o .... ....

?
 
Old 12-12-2004, 12:39 PM   #3
sonika_singhi
Member
 
Registered: Oct 2004
Location: india
Distribution: fedora core
Posts: 34

Original Poster
Rep: Reputation: 15
yes we have tried with the option gcc -lmysqlclient..... but getting errors after this
don't know what to do?
is this mysqlclient the library file
pls specify from the beginning.
we are using this mysql with c for the first time, it is relevant to our project
hoping for reply
 
Old 12-12-2004, 02:35 PM   #4
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Errors probably means you don't have the library or its headers. Check if you have mysql-devel package installed.
 
Old 12-12-2004, 03:19 PM   #5
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
You may also need to pass -L <directory with MySQL library> if libmysqlclient is not in one of the standard library directories. You can figure out where it is for sure by typing "locate libmysqlclient" at a command prompt.
 
Old 12-15-2004, 09:37 AM   #6
rajesh_b
Member
 
Registered: Sep 2004
Location: Hyderabad.
Posts: 83

Rep: Reputation: 15
In order to interface to mysql u must install developement libraires corresponding to the version of mysql installed on u r system. After u have installed i think the following command can be used to compile the prog

gcc `mysql_config --libs --cflags` progname.c
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing an app that uses a mysql database without installing mysql server? QtCoder Programming 4 08-09-2004 02:43 PM
MYSQL help - mysql database missing eloviyandhi Linux - Software 1 03-20-2004 09:20 PM
Mysql database from cd JHuizingh Linux - Software 0 02-22-2003 02:08 PM
mysql database huno Linux - General 8 02-11-2003 08:15 PM
accessing mysql from apache/mysql vher Linux - Newbie 1 01-17-2003 02:38 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration