Subject: Re: Cygwin + Windows 7 + (C++) + GNU Science Library (GSL) Not Working
From: Csaba Raduly <[email-masked]>
To: [email-masked]
Cc: Dilan Shah <[email-masked]>
Date: Tue, 22 Feb 2011 17:10:35 +0100
List-Id: <cygwin.cygwin.com>

Hi Dilan,

On Tue, Feb 22, 2011 at 4:36 PM, Dilan Shah wrote:
(snip)
> Whenever I try to compile this code in Cygwin it gives the following error:
>
> $ make 8DMonteCarloIntegration
> g++     8DMonteCarloIntegration.cc   -o 8DMonteCarloIntegration
> /cygdrive/c/Users/DEFAUL~1.DIL/AppData/Local/Temp/ccNuQcib.o:8DMonteCarloIntegration.cc:(.text+0x99):
> undefined reference to `_gsl_rng_default'

Your makefile is wrong. You told make to build the file
8DMonteCarloIntegration, but you haven't told make how to do it: there
is no target called 8DMonteCarloIntegration. Make did its best with a
built-in rule it has, but you didn't set up the make variables for
that to work correctly.

In general, you shouldn't put compiler options into the variable that
defines the compiler. There are separate variables for that, e.g.
CFLAGS for the C compiler, CXXFLAGS for the C++ compiler, CPPFLAGS for
the preprocessor (you should put -I and -D flags here), LDFLAGS for
the linker (e.g. -L for library location but not -l for library
names).

This is not a Cygwin problem. You would get the same error on any
Unix-like platform.
You should read the documentation for GNU make (especially sections
10.2 Catalog of implicit rules and 10.3 Variables used by implicit
rules) and/or ask on a general programming forum.

Hope this helps,
Csaba
-- 
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple