开发者

Getting the Gnu Scientific Library to work in Cygwin

I'm using gsl and Cygwin, and to get started I am trying to compile a very simple program (which I will later call from a Fortran program). I am unable to get it compile due to problems locating the the gsl files. The code is:

#include <gsl/gsl_math.h>

void gslgateway_(double *x, double *res){
   *res = gsl_atanh(*x);
}

When I try to compile it by:

gcc -c gslgateway.c

I get the following error:

gslgateway.c:1:26: error: gsl/gsl_math.h: No such file or directory

If I change the first line to

#include <C:/cygwin/usr/include/gsl/gsl_math.h>

then gsl_math.h is found, but a bunch of other files are not:

In file included from gslgateway.c:1:
C:/cygwin/usr/include/gsl/gsl_math.h:23:25: error: gsl/gsl_sys.h: No such file or directory
...

So, the problem seems to be the path to the library files. But try as I might, I can't seem to set this correctly. I used gsl-config as suggested at Using GSL with cygwin g++ and it gives me

-L/usr/include

so I tried compiling using that as an option, but I get the same res开发者_运维技巧ult. I've also tried setting LD_LIBRARY_PATH to /usr/lib, /usr/include, C:/cygwin/usr/include and several other combinations but nothing works.

I don't know what else to try now. Can anyone see what I'm missing?

(Other info: I have gsl-devel installed. At least, I asked the Cygwin Installer to install it, and I can find a folder /usr/include/gsl that contains gsl_math.h amongst many other files. I don't know if there's anything else I need to do there.)


Since my guess appears to have been correct, I'll post it as an answer.

It looks like you're using the MinGW compiler. MinGW isn't part of Cygwin, so it doesn't understand Cygwin-style paths. That's why your compiler was able to find C:/cygwin/usr/include/ but not /usr/include.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜