Linking to the Gnu Scientific Library is very well documented using gcc for Linux & Cygwin.
Here, I'm working on Windows 7, and all I have is the lcc
compiler (http://www.cs.virginia.edu/~lcc-win32/ , which includes lcc64 and lcclnk64) and GSL libraries for Windows 64bits (https://code.google.com/p/oscats/downloads/detail?name=gsl-1.15-dev-win64.zip&can=2&q=).
I do not have cygwin/mingw/msys/Visual Studio.
My question pertains to lcc
and the libraries found in gsl-1.15-dev-win64.zip
. The test code is
#include <stdio.h>
#include <gsl/gsl_sf_gamma.h>
int main (void)
{
double a = 20;
double b = 10;
double x = 0.5;
double result = gsl_sf_beta_inc(a, b, x);
printf("%f\n", result);
return 0;
}
Compiling isn't the problem. Linking to the gsl static library using lcclnk64
is the question. I've tried variation of the following:
lcclnk64 test.obj -Lc:\gsl\lib -lgsl
first compiling with lcc64
then linking, or running the entire process with one lc64
call, using libgsl.dll.a
, libgsl.a
, lgsl
and libgsl.lib
after renaming libgsl.dll.a
to libgsl.lib
, and with/without -subsystem console
. I still get:
connect test.obj .text: undefined reference to 'gsl_sf_beta_inc'
I'd like to link to a static GSL library to obtain a standalone exe
, on Windows 7 and using lcc
, and not have to send dlls with the exe if I have to share the exe
. Getting test.obj
is easy, it's getting the object linked to libgsl.???
that is totally stymieing me. Thanks for any pointers.
EDIT:
I got the following to compile and link without error, but when I run test.exe
I get an error dialog telling me a DLL is missing and I need to reinstall the program.
lcc64 test.c -Ic:\gsl\include
lcclnk64 test.obj libgsl.lib -Lc:\gsl\lib -subsystem console