LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-07-2004, 02:14 PM   #1
ksalopek
LQ Newbie
 
Registered: Jan 2004
Posts: 24

Rep: Reputation: 15
Connecting to MySQL


Hello,

I am still a newbie at Linux, and I am trying to get some C/C++ code to compile and run that will connect to a MySQL database on a Windows 2000 computer on my network.

I cannot get any code to compile if I do any more than:

#include "/usr/local/mysql/mysql.h"
..
..
MYSQL *test;
MYSQL_ROW row;
MYSQL_RES res;

if i try to do mysql_connect() i get the error 'mysql_connect undeclared'

I use the compile command:
gcc main.o main.cpp -I/usr/local/mysql/include -L/usr/local/mysql/lib -lmysqlclient

the include and library files for mysql are in the /usr/local/mysql directory

I have not actually installed mysql on the linux box since I am trying to connect to the windows box.

Any suggestions?
 
Old 06-07-2004, 02:47 PM   #2
marghorp
Senior Member
 
Registered: Jan 2004
Location: Slovenia
Distribution: Slackware 10.1, SLAX to the MAX :)
Posts: 1,040

Rep: Reputation: 45
read the errors. connection undeclared. Shouldn't there be any parameters for mysql connecting?
 
Old 06-07-2004, 05:16 PM   #3
ksalopek
LQ Newbie
 
Registered: Jan 2004
Posts: 24

Original Poster
Rep: Reputation: 15
Sorry, i forgot to say that I did pass everything that was in the tutorial (changed to meet my system specs of course), and I still go the error
 
Old 06-07-2004, 06:14 PM   #4
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
Check the pathname to that header file -- on my system it's located at /usr/local/mysql/include/mysql/mysql.h. You're probably better off with something like:

#include <mysql/mysql.h>

And then your include path looks correct.
 
Old 06-11-2004, 10:05 AM   #5
ksalopek
LQ Newbie
 
Registered: Jan 2004
Posts: 24

Original Poster
Rep: Reputation: 15
I looked and the actual file mysql.h is at /root/mysql/include so I think I have it going to the right place.

Unless it cannot be in root or something like that.
 
Old 06-11-2004, 10:07 AM   #6
ksalopek
LQ Newbie
 
Registered: Jan 2004
Posts: 24

Original Poster
Rep: Reputation: 15
I realize that I have a different path other than /root/mysql/include , but i have tried both ways with no luck.

From a friend, I was told that if i install the RPM for mysql it should make a folder in the /usr/local/include, but I have not been able to get it to do that either!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Connecting to Mysql blood_omen Debian 6 07-23-2004 02:20 AM
connecting to mysql dkc_ace Linux - General 2 03-22-2003 08:18 PM
Connecting to mysql webee Linux - Software 2 01-30-2003 03:47 PM
connecting mysql by php norbs Linux - Software 1 07-25-2002 02:40 AM
Mysql is not connecting from servlet.But connecting from java, help pls Harish_f Linux - General 0 05-08-2002 04:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:55 PM.

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