Reputation: 71
Trying to use GSL to generated beta-distributed random deviates in C on windows. Program will not link, giving the well known "error LNK2001: unresolved external symbol _gsl_rng_default" error message.
Problem is not with the general installation of GSL. I can compile and call cdf functions just fine. But, for the record:
Program has the following includes:
#include <gsl/gsl_randist.h>
#include <gsl/gsl_cdf.h>
#include <gsl/gsl_rng.h>
Configuration Properties->C/C++->General->Additional Include Directories points to the GSL-1.15\include directory.
Configuration Properties->Linker->General->Additional Library Directories points to the GSL-1.15\lib directory.
Configuration Properties->Linker->Input->Additional Dependencies has two entries, libgsl.dll.a and libgslcblas.dll.a
Program compiles and links if the line T = gsl_rng_default;
is removed.
With T = gsl_rng_default;
the program compiles does not link.
Tried including GSL_DLL as a preprocessor definition. No effect on problem.
Tried #define GSL_DLL
at top of program. Still has no effect on the problem.
Tried all setting options under Configuration Properties->C/C++->Code Generation->Runtime Library. No effect on problem.
Is there another switch that has to be thrown to make this work with Visual Studio 2008?
Upvotes: 2
Views: 1148
Reputation: 20774
Add "GSL_DLL" to Configuration -> C/C++ -> Preprocessor > Preprocessor Definition.
Upvotes: 2