LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Link Problem (https://www.linuxquestions.org/questions/programming-9/link-problem-114052/)

LOUDSilence 11-09-2003 07:18 AM

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

LOUDSilence 11-09-2003 07:33 AM

By the way, I do have mysql installed and the .h and .so files are there

MartinN 11-09-2003 09:56 AM

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

Looking_Lost 11-09-2003 10:05 AM

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.

LOUDSilence 11-09-2003 10:37 PM

Thanks guys prob solved.


All times are GMT -5. The time now is 03:27 AM.