* unable to compile example program;
@ 2002-08-14 8:31 Y. U. Sasidhar
2002-08-14 8:57 ` Ed Hill
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Y. U. Sasidhar @ 2002-08-14 8:31 UTC (permalink / raw)
To: gsl-discuss
1. I am trying compile the example program:
=============================================
#include <stdio.h>
#include <gsl/gsl_sf_bessel.h>
int
main (void)
{
double x = 5.0;
double y = gsl_sf_bessel_J0 (x);
printf("J0(%g) = %.18e\n", x, y);
return 0;
}
=============================================
using
gcc gsl.c -o gsl
and getting the error:
-----------------------------------------
undefined reference to `gsl_sf_bessel_J0'
collect2: ld returned 1 exit status
--------------------------------------------
OS redhat 7.1 on PIV
gsl version .7
2. How do I know which header file to include for a
given function and dependencies of the given function
on others. The manual lists only function description
with return types etc. It does not mention header
files necessary and depedencies.
Sasidhar
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: unable to compile example program;
2002-08-14 8:31 unable to compile example program; Y. U. Sasidhar
@ 2002-08-14 8:57 ` Ed Hill
2002-08-14 9:47 ` Fleur Kelpin
2002-08-14 13:45 ` Brian Gough
2 siblings, 0 replies; 5+ messages in thread
From: Ed Hill @ 2002-08-14 8:57 UTC (permalink / raw)
To: gsl-discuss
On Wed, 2002-08-14 at 09:31, Y. U. Sasidhar wrote:
> 1. I am trying compile the example program:
[*SNIP*]
> gcc gsl.c -o gsl
>
> and getting the error:
> -----------------------------------------
> undefined reference to `gsl_sf_bessel_J0'
> collect2: ld returned 1 exit status
> --------------------------------------------
Hi Sasidhar,
This is a link-time (ld) error, not a header problem. You need to
provide the libraries containing the code declared in the header(s)
using something like:
gcc gsl.c -o gsl -lgsl -lgslcblas
which, on my RH 7.3 system, works fine with your example problem:
[edhill@XXX ~]$ ./gsl
J0(5) = -1.775967713143382920e-01
[edhill@XXX ~]$
hth,
Ed
--
Edward H. Hill III, PhD
Post-Doctoral Researcher | Email: ed@eh3.com, ehill@mines.edu
Division of ESE | URLs: http://www.eh3.com
Colorado School of Mines | http://cesep.mines.edu/people/edhill.php
Golden, CO 80401 | Phone: 303-273-3483 Fax: 303-273-3311
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: unable to compile example program;
2002-08-14 8:31 unable to compile example program; Y. U. Sasidhar
2002-08-14 8:57 ` Ed Hill
@ 2002-08-14 9:47 ` Fleur Kelpin
2002-08-15 6:11 ` Y. U. Sasidhar
2002-08-14 13:45 ` Brian Gough
2 siblings, 1 reply; 5+ messages in thread
From: Fleur Kelpin @ 2002-08-14 9:47 UTC (permalink / raw)
To: Y. U. Sasidhar; +Cc: gsl-discuss
> gcc gsl.c -o gsl
You need to link the gsl library using -lgsl
Check the manual for details.
> 2. How do I know which header file to include for a
> given function and dependencies of the given function
> on others. The manual lists only function description
> with return types etc. It does not mention header
> files necessary and depedencies.
You could use grep to search the gsl header files for the function you
need. I don't know in which dir RH stores those files, my guess is
/usr/include/gsl
$ grep gsl_sf_bessel_J0 /usr/include/gsl/*
gsl_sf_bessel.h:int gsl_sf_bessel_J0_e(const double x, gsl_sf_result *
result);
gsl_sf_bessel.h:double gsl_sf_bessel_J0(const double x);
If that does not work on your system, search for the header files and use
that dir.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: unable to compile example program;
2002-08-14 9:47 ` Fleur Kelpin
@ 2002-08-15 6:11 ` Y. U. Sasidhar
0 siblings, 0 replies; 5+ messages in thread
From: Y. U. Sasidhar @ 2002-08-15 6:11 UTC (permalink / raw)
To: gsl-discuss
Many thanks for the responses.
Once I installed the recent 1.2 version rpm there was
no problem with compiling ( with -lgsl -lgslcblas ).
I was using .7 version earlier.
Sasidhar
--- Fleur Kelpin <fleur@bio.vu.nl> wrote: > > gcc
gsl.c -o gsl
>
> You need to link the gsl library using -lgsl
> Check the manual for details.
>
> > 2. How do I know which header file to include for
> a
> > given function and dependencies of the given
> function
> > on others. The manual lists only function
> description
> > with return types etc. It does not mention header
> > files necessary and depedencies.
>
> You could use grep to search the gsl header files
> for the function you
> need. I don't know in which dir RH stores those
> files, my guess is
> /usr/include/gsl
>
> $ grep gsl_sf_bessel_J0 /usr/include/gsl/*
> gsl_sf_bessel.h:int gsl_sf_bessel_J0_e(const double
> x, gsl_sf_result *
> result);
> gsl_sf_bessel.h:double gsl_sf_bessel_J0(const double
> x);
>
> If that does not work on your system, search for the
> header files and use
> that dir.
>
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: unable to compile example program;
2002-08-14 8:31 unable to compile example program; Y. U. Sasidhar
2002-08-14 8:57 ` Ed Hill
2002-08-14 9:47 ` Fleur Kelpin
@ 2002-08-14 13:45 ` Brian Gough
2 siblings, 0 replies; 5+ messages in thread
From: Brian Gough @ 2002-08-14 13:45 UTC (permalink / raw)
To: Y. U. Sasidhar; +Cc: gsl-discuss
Y. U. Sasidhar writes:
> 2. How do I know which header file to include for a
> given function and dependencies of the given function
> on others. The manual lists only function description
> with return types etc. It does not mention header
> files necessary and depedencies.
The header files are given at the beginning of the section
where the function is described.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-08-15 13:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-14 8:31 unable to compile example program; Y. U. Sasidhar
2002-08-14 8:57 ` Ed Hill
2002-08-14 9:47 ` Fleur Kelpin
2002-08-15 6:11 ` Y. U. Sasidhar
2002-08-14 13:45 ` Brian Gough
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).