including files from GNU GSL

J

Joseph Wakeling

Hello all,

I'm writing some programs that will be using modules from the GNU
Scientific Library (GSL).

Include commands within the GSL modules have commands such as,

#include <gsl/gsl_rng.h>

(for example). Yet these header files aren't actually in the gsl
directory.

The result is that when I try to compile a program, even one from the
GSL, it can't find the necessary headers.

I *am* using compiler option gcc -I (directory) where (directory) is
the dir. containing the gsl/ dir.

What am I doing wrong here? Even the simple Example Program given in
the GSL manual won't compile.

(I don't want to go through compiling to object form the whole GSL; I
just want to be able to compile one or two modules for a program I'm
writing.)
 
P

pete

Joseph said:
Hello all,

I'm writing some programs that will be using modules from the GNU
Scientific Library (GSL).

Include commands within the GSL modules have commands such as,

#include <gsl/gsl_rng.h>

(for example). Yet these header files aren't actually in the gsl
directory.

The result is that when I try to compile a program, even one from the
GSL, it can't find the necessary headers.

I *am* using compiler option gcc -I (directory) where (directory) is
the dir. containing the gsl/ dir.

What am I doing wrong here?

You are posting to the wrong newsgroup.

http://www.ungerhu.com/jxh/clc.welcome.txt
 
A

Aleramo

Have u linked all the libraries? i use linux knoppix and i have to
write:
gcc namefile.c -lgsl -lgslcblas
 
J

Joseph Wakeling

Hi Aleramo---I hadn't been doing that, so thanks for the info; but
including those options makes no difference. :-(

FWIW I'd like to be able to work out how to do this in a way that is
independent of the compiler I'm using... ;-)
 
C

Christopher Benson-Manica

J

Joseph Wakeling

Fair enough. There's no newsgroup dedicated to GSL so I thought I'd
try here since it is still a C problem (even though it's not standard
C). Besides, it struck me that the problem I was having wasn't really
GSL per se but to do with how #include commands are processed and made
use of.

Thanks for the links!
 
F

Flash Gordon

Joseph said:
Fair enough. There's no newsgroup dedicated to GSL so I thought I'd

They may well have mailing lists or web based forums.
try here since it is still a C problem (even though it's not standard
C). Besides, it struck me that the problem I was having wasn't really
GSL per se but to do with how #include commands are processed and made
use of.

Thanks for the links!

As an example of why that is still off topic, do you want me to tell you
how to set up the include path within the Visual Studio IDE? Or for the
Texas Instruments TMS320C1x/2x/5x compiler?
 
K

Kenny McCormack

It's not possible from the perspective of this group, which discusses
only standard C.

Or, to put it more succinctly (and succinct is good - this being a C group
and all):

Not portable. Can't discuss it here. Blah, blah, blah.
 
J

Joseph Wakeling

"Not portable. Can't discuss it here. Blah, blah, blah."

You see, *that*, despite being a negative answer, still had positive
effect because it was funny. :)

This whole discussion might have been considerably briefer, if instead
of posting me links to stern discussions of what is and isn't on-topic
for the list, someone had instead posted me a link to somewhere that
*might be able to help me*.
 
P

pete

Joseph Wakeling wrote:
This whole discussion might have been considerably briefer, if instead
of posting me links to stern discussions of what is and isn't on-topic
for the list, someone had instead posted me a link to somewhere that
*might be able to help me*.

Why would you expect anybody on this newsgroup
to have more information on that topic
than what is in clc.welcome.txt?
 
C

Christopher Benson-Manica

Joseph Wakeling said:
This whole discussion might have been considerably briefer, if instead
of posting me links to stern discussions of what is and isn't on-topic
for the list, someone had instead posted me a link to somewhere that
*might be able to help me*.

Standard comp.lang.c operating procedure, I'm afraid. Put simply,
our ability to STFW is equal to yours, although admittedly my advice
to "find a GNU group and post there" wasn't particularly helpful given
the low traffic of the gnu.* groups.

That said, it's possible (verification is left as an exercise for the
reader) that comp.unix.programmer would be an appropriate and
profitable venue for your question.
 
J

jacob navia

Joseph Wakeling a écrit :
Hello all,

I'm writing some programs that will be using modules from the GNU
Scientific Library (GSL).

Include commands within the GSL modules have commands such as,

#include <gsl/gsl_rng.h>

(for example). Yet these header files aren't actually in the gsl
directory.

The result is that when I try to compile a program, even one from the
GSL, it can't find the necessary headers.

I *am* using compiler option gcc -I (directory) where (directory) is
the dir. containing the gsl/ dir.

What am I doing wrong here? Even the simple Example Program given in
the GSL manual won't compile.

(I don't want to go through compiling to object form the whole GSL; I
just want to be able to compile one or two modules for a program I'm
writing.)
The problem is that you have the include directive
gsl/gsl_rng.h

This means that the file should be in the gsl SUBDIRECTORY

Supposing your files are in
<somedir>, doing
-I<somedir>
will NOT work since the compiler will look at
<somedir/gsl>
that does not exist.

Solution:

make a subdirectory gsl in <somedir> and put all your files in that
subdirectory. Then do
-I<somedir>

and should work
 
J

jacob navia

Joseph Wakeling a écrit :
"Not portable. Can't discuss it here. Blah, blah, blah."

You see, *that*, despite being a negative answer, still had positive
effect because it was funny. :)

This whole discussion might have been considerably briefer, if instead
of posting me links to stern discussions of what is and isn't on-topic
for the list, someone had instead posted me a link to somewhere that
*might be able to help me*.
Please see the other answer in this same thread that I
posted a minute ago.

I think I found what your problem is, and it has surely relevance
for this group.

All this people telling

<off topic>

are just telling nonsense. Please do not generalize, not all
people here are like that.

jacob
 
K

Keith Thompson

Joseph Wakeling said:
I'm writing some programs that will be using modules from the GNU
Scientific Library (GSL).

Include commands within the GSL modules have commands such as,

#include <gsl/gsl_rng.h>

(for example). Yet these header files aren't actually in the gsl
directory.

The result is that when I try to compile a program, even one from the
GSL, it can't find the necessary headers.

I *am* using compiler option gcc -I (directory) where (directory) is
the dir. containing the gsl/ dir.

What am I doing wrong here? Even the simple Example Program given in
the GSL manual won't compile.

(I don't want to go through compiling to object form the whole GSL; I
just want to be able to compile one or two modules for a program I'm
writing.)

If the extensive documentation provided with both gcc and gsl doesn't
help, you might try gnu.gcc.help or comp.unix.programmer.

If you post somewhere else, it will be very helpful if you provide a
small complete compilable (or, in your case, not compilable) program
that illustrates the problem, along with the exact command line you're
using. Telling us that you're using the -I option is much less useful
than showing us exactly how you're using it. Don't re-type your code
or command line; copy-and-paste it exactly.

Note also that there's a difference between
#include <gsl/gsl_rng.h>
and
#include "gsl/gsl_rng.h'
 
J

Joseph Wakeling

Standard comp.lang.c operating procedure, I'm afraid. Put simply,
our ability to STFW is equal to yours, although admittedly my advice
to "find a GNU group and post there" wasn't particularly helpful given
the low traffic of the gnu.* groups.

Fair dos---and I did very much appreciate the gnu.* groups advice, and
also the comp.unix.programmer suggestion. I wasn't really thinking of
your post when making my critique.

The STFW point is of course true, but one hopes that a group of highly
experienced C programmers might always contain someone who has the
knowhow to point you in the right direction *without* having to STFW
first. To answer Pete's question,
Why would you expect anybody on this newsgroup
to have more information on that topic
than what is in clc.welcome.txt?

The group of people who are interested in comp.lang.c topics, and the
people who are interested in GSL, undoubtedly has overlap (as proven by
one of the replies to my original post). It seems to me it's better to
acknowledge and make use of that overlap than it is to automatically
censure a query simply because it falls "outside the line".

I'm sure there's a very real need to restrict discussion in order to
protect the key focus of the group from being obliterated by idiots
such as me, but there's ways and means. Firstly if anyone in the group
has knowledge that can be used to redirect an OT question to an
appropriate group, it's silly not to do so. It's not a question of
STFW on someone else's behalf, but one of being able to provide someone
a shortcut so that *no one* has to STFW. And the chances are the
beneficiary of this advice will say, "Thank you!" and leave the group
with feelings of goodwill that both encourage them to contribute to,
but also to respect the discussion area of, the original group. And I
do very much thank the contributors here who have offered helpful
suggestions.

But even if that's not possible I see little point in a post which just
says: "You're off topic." If you can't help, fine, and if you want to
protect the group's subject area, fine; but it wouldn't hurt to be just
a little polite about it. If someone is persistently posting questions
outside of the group's subject area, some harsh words are perhaps in
order. But if a newcomer comes and posts something in good faith, even
if it's dumb, a little bit of concern and nice words (along with a
polite request) seem a better option. It makes it a hell of a lot more
likely the person concerned will (a) appreciate your reasons for being
unable to help and (b) try much harder to be a good citizen of the
group in future.

(... It also protects you from idiots like me who, when they feel
someone is being impolite, will write a big long message saying
why---and explaining why it's a bad idea.)

Just because C compilers are invariably abrupt and blunt when dealing
with an error, does not oblige C programmers to be. ;-)
 
J

Joseph Wakeling

Hi Jacob,

Thanks very much for your advice. I wouldn't dream of generalizing, I
was just pissed off with one or two of the *specific* responses I
received. :p

Basically when you download GSL you get a gzipped tarball of a
directory containing a whole load of header files, subdirectories
containing source for modules, etc. etc. At first glance it looks like
you should be able to just copy it where you like and just use it as a
source library. The problem with that is that, as I posted originally,
many of the important header files are in the wrong place in the tree.

Actually after getting hold of some GSL-specific help on a mailing list
(about 10 minutes ago!) it looks like the problem is a bit more
complex. Essentially GSL as it is provided is not simply a set of
source and header files which you copy to your /include/ directory.
What's intended is that you use included makefiles to run an install
process on the files downloaded. This sets up various things in the
compiler include/ directory, including a directory called gsl/ into
which all the important gsl header files are placed (meaning a command
like "#include <gsl/gsl_rng.h>" *will* work). It also compiles
everything in the GSL library into object files ready for use.

It's also relatively easy, apparently, to edit the makefiles so as to
use whatever compiler you like. :)

I was kind of hoping to be able to use individual modules and compile
as necessary, but apparently that's tricky (too many dependencies
between the different parts of the GSL---it's easier to rely on their
own makefiles than to try and include stuff in your own). Still, I
might well rewrite some of the code so as to be able to do that,
because although it's very good code as-is, I think for the specific
things I'm interested in doing, it can be streamlined and made a lot
simpler and faster.

If this isn't clear, I'm happy to try to explain further, but I don't
want to make anyone more cross than I already have. ;-)
 
J

Joseph Wakeling

Hi Keith---believe me, I did try to find what I was doing wrong via the
GSL Manual; but didn't get anwhere. The important information seems to
be inside some of the files included in the GSL download, but to a
relative novice in large-scale programming, the what-where-why of it
all wasn't obvious. Anyway, as my reply to Jacob should show, I found
out where the source of my problem was. My mistake was to assume that
the GSL library was "ready-for-use" as it was downloaded, instead of
needing to run some make instructions to set it all up on the system.

Thanks very much for the group suggestions since I'm sure they'll be
useful on other occasions! :)
 
K

Keith Thompson

Joseph Wakeling said:
Hi Keith---believe me, I did try to find what I was doing wrong via the
GSL Manual; but didn't get anwhere. The important information seems to
be inside some of the files included in the GSL download, but to a
relative novice in large-scale programming, the what-where-why of it
all wasn't obvious. Anyway, as my reply to Jacob should show, I found
out where the source of my problem was. My mistake was to assume that
the GSL library was "ready-for-use" as it was downloaded, instead of
needing to run some make instructions to set it all up on the system.

Thanks very much for the group suggestions since I'm sure they'll be
useful on other occasions! :)

Another piece of advice: Learn to post proper followups. You can see
here that I've quoted your article and provided an attribution line,
which makes it much easier to follow the discussion. Google's broken
interface makes this difficult. Search this newsgroup for "google
context" for instructions on how to work around the problem.

<OFF_TOPIC>
Outside the Windows/Intel world, most free software is distributed as
source. Look in the distributed package for a file called INSTALL
and/or README for installation instructions.
</OFF_TOPIC>
 
J

Joseph Wakeling

Keith said:
Another piece of advice: Learn to post proper followups. You can see
here that I've quoted your article and provided an attribution line,
which makes it much easier to follow the discussion. Google's broken
interface makes this difficult. Search this newsgroup for "google
context" for instructions on how to work around the problem.

Aaah. I had been wondering about that. Thanks very much. :)

<off_topic>
Incidentally Google still won't make things easy in this respect, since
you have to go to the "advanced search" options, and make sure to ask
for best part of 100 posts, to actually get the relevant information.
If you just use the default search box, you just get a load of posts
telling you: 'To find out how to do this, search this group for "google
context" ... !'
</off_topic>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,785
Latest member
undedgini

Latest Threads

Top