LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-20-2012, 03:41 AM   #1
homerzhou
LQ Newbie
 
Registered: Aug 2012
Posts: 3

Rep: Reputation: Disabled
Talking Litte question about the Library


I often can't confirm that what the Library I should Link with the Header File.
For example, I use the Header File ---mysql.h ,I don't know which library I should link . However I can search the Internet to know the answer, I want to know how I can get the explicit location of Library from the Header File.
 
Old 09-20-2012, 08:07 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
In the specific case of MySQL, you would look in the MySQL Reference Manual in the Connectors and API section which shows example code and details the required header file for compiling and librar[y|ies] for linking.

In other cases, the manual page for a given function will include librar[y|ies) to be included; e.g., if you were to use the atan() function, the manual page for that function includes
Quote:
NAME
atan, atanf, atanl - arc tangent function

SYNOPSIS
#include <math.h>

double atan(double x);
float atanf(float x);
long double atanl( long double x);

Link with -lm.
Hope this helps some.
 
1 members found this post helpful.
Old 09-20-2012, 08:10 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,927

Rep: Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320
you can use the command nm to check if a library contained the given function (not the header, but the function you use from that header)
 
1 members found this post helpful.
Old 09-20-2012, 09:03 AM   #4
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
Hi

On Debian-based distros you can also use "apt-file". I don't know if there's anything similar for RPM.
 
  


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
Question about library tonyr81 Linux - Kernel 8 05-19-2008 02:46 PM
General question and Library question gauol Linux - General 1 10-20-2007 07:10 PM
Question about Readline Library sasha_baranov Programming 0 08-23-2004 03:39 PM
library linking question. shaggz Linux - General 1 04-25-2004 11:22 PM
shared library question budzynm Linux - Software 1 09-21-2003 10:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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