LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 11-09-2003, 07:18 AM   #1
LOUDSilence
Member
 
Registered: Oct 2003
Location: Sydney
Distribution: Red Hat 8
Posts: 77

Rep: Reputation: 15
Question Link Problem


Hi everyone,

I dont know if this is the right place to ask this question. but this is the only place like this
I am registed with and I use linux so I thought I would give it a go.

I am trying to link libmysqlclient.so to my C program but don't know how. It can not find the library file

$ ld -llibmysqlclient.so
ld: cannot find -llibmysqlclient.so

$ ld -l/usr/lib/libmysqlclient.so
ld: cannot find -l/usr/lib/libmysqlclient.so

I am using Anjuta as my IDE, but at the monment I just want to know how to find the libraries. I am a working programmer but Windows Borland C++, moving all the code over to Linux as the licences are cheaper for the company

Please let me know if you need more information.

Thanks
 
Old 11-09-2003, 07:33 AM   #2
LOUDSilence
Member
 
Registered: Oct 2003
Location: Sydney
Distribution: Red Hat 8
Posts: 77

Original Poster
Rep: Reputation: 15
By the way, I do have mysql installed and the .h and .so files are there
 
Old 11-09-2003, 09:56 AM   #3
MartinN
Member
 
Registered: Nov 2003
Location: Ronneby, Sweden
Posts: 555

Rep: Reputation: 30
If YOU don't know where the library file is, then you can use locate or find to find it on your system:

locate uses a database that is updated regularly (once every day, or so). Just type:
locate libmysqlclient.so

But if you have recently added the file, or if you don't trust the database, then you could use find:
find / -name 'libmysqlclient.so'
This will probably take a while. Possibly long enough to go get another cup of tea.

When you have found your library, use flag -L with ld to include the path to your library in ld's search path.

Regards
Martin
 
Old 11-09-2003, 10:05 AM   #4
Looking_Lost
Senior Member
 
Registered: Apr 2003
Location: Eire
Distribution: Slackware 12.0, OpenSuse 10.3
Posts: 1,120

Rep: Reputation: 45
May not be of use to you as I don't use ld directly but when I'm using gcc to compile I have amongst other options:

first one is an eye, I

-I/pathto/mysql/include/directory -L/pathto/mysql/Lib/directory -lmysqlclient

Don't know much about it really, only be using it to brush up on my C whilst doing something practical.
 
Old 11-09-2003, 10:37 PM   #5
LOUDSilence
Member
 
Registered: Oct 2003
Location: Sydney
Distribution: Red Hat 8
Posts: 77

Original Poster
Rep: Reputation: 15
Thanks guys prob solved.
 
  


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
D-Link problem apocolipse Linux - Wireless Networking 8 07-03-2005 08:39 AM
Wake on Lan - Link on b4 power up, No Link light after shutdown? Mark007 Linux - Networking 0 11-20-2004 08:16 PM
Redhat 8.0 Symbolic Link Problem & Maillog Problem. borisys Red Hat 1 07-27-2004 09:35 AM
Link problem please help talonnb Linux - Newbie 3 08-02-2003 03:12 PM
help: link problem titanium_geek Linux - General 1 07-28-2003 08:27 PM

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

All times are GMT -5. The time now is 07:27 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