Cygwin + Windows 7 + (C++) + GNU Science Library (GSL) Not Working

2011-02-22 Thread Dilan Shah

I have a simple piece of C++ code below:

#include 
#include 
#include "gsl/gsl_rng.h"
#include "cavlib/constants.hh"

using namespace std;

// Random number generator (between 0 and 1)
double random_number()
{
  gsl_rng* rng = gsl_rng_alloc( gsl_rng_default );
  double random_number = gsl_rng_uniform( rng );
  gsl_rng_free( rng );
  return random_number;
}

// Function to estimate the integral using N points
double integral_estimate(int N)
{
  sin(0);
}

int main(void)
{
  cout << random_number();
  return 0;
}

I am using the latest version of Cygwin on Windows 7, with everything that
could possibly be installed on Cygwin.

The cavlib is a library that is in a folder called cavlib with the source
code, which has filename 8DMonteCarloIntegration.cc

The cavlib is working fine and I don't think that this is any cause of the
problem.

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'
/cygdrive/c/Users/DEFAUL~1.DIL/AppData/Local/Temp/ccNuQcib.o:8DMonteCarloIntegration.cc:(.text+0xa1):
undefined reference to `_gsl_rng_alloc'
/cygdrive/c/Users/DEFAUL~1.DIL/AppData/Local/Temp/ccNuQcib.o:8DMonteCarloIntegration.cc:(.text+0xaf):
undefined reference to `_gsl_rng_uniform'
/cygdrive/c/Users/DEFAUL~1.DIL/AppData/Local/Temp/ccNuQcib.o:8DMonteCarloIntegration.cc:(.text+0xbd):
undefined reference to `_gsl_rng_free'
collect2: ld returned 1 exit status
make: *** [8DMonteCarloIntegration] Error 1

I am also using a Makefile:

.SUFFIXES: .cc .hh .o 

CC = g++ -O2 -g -pedantic -Wall 
INCLUDE= -I$(GSL_INC) -I$(FFTW_INC)
LIBS   = -lgsl -lgslcblas -lfftw3  
RM = /bin/rm -f

%.o : %.cc
$(CC) $(INCLUDE) -c -o $@ $<

# Define the source code modules for the library:

SOURCE = \
constants.cc\
null.cc\
string_util.cc\
file_util.cc\
vector_util.cc\
gslint_random.cc\
getopt_pp.cc

default: cavlib.a test.exe vec3_test.exe tar

cavlib.a: $(SOURCE:.cc=.o)
ar rv cavlib.a $(SOURCE:.cc=.o) 

test.exe: cavlib.a test.cc
$(CC) -o $@ test.cc cavlib.a $(LIBS)

vec3_test.exe: cavlib.a vec3_test.cc
$(CC) -o $@ vec3_test.cc cavlib.a $(LIBS)   

clean:
$(RM) $(SOURCE:.cc=.o) cavlib.a
$(RM) test.exe cavlib.tar vec3_test.exe 

tar:
tar cvf cavlib.tar *.cc *.hh Makefile


It appears there are some problems with using the GSL library, I have tried
to search for a solution here and several other places, but I cannot seem to
find a solution for this, information on this subject is very limited.  Any
kind of help to get this working would be appreciated, thanks.
-- 
View this message in context: 
http://old.nabble.com/Cygwin-%2B-Windows-7-%2B-%28C%2B%2B%29-%2B-GNU-Science-Library-%28GSL%29-Not-Working-tp30986807p30986807.html
Sent from the Cygwin list mailing list archive at Nabble.com.


--
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



Re: Cygwin + Windows 7 + (C++) + GNU Science Library (GSL) Not Working

2011-02-22 Thread Dilan Shah

I appreciate the help and pointing in the right direction, but I am not sure
that the Makefile is the issue, as it has been created by someone else and
tested to work fine on Linux.
-- 
View this message in context: 
http://old.nabble.com/Cygwin-%2B-Windows-7-%2B-%28C%2B%2B%29-%2B-GNU-Science-Library-%28GSL%29-Not-Working-tp30986807p30988843.html
Sent from the Cygwin list mailing list archive at Nabble.com.


--
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



GNUPLOT in Cygwin: Terminal type set to 'unknown'

2011-02-24 Thread Dilan Shah

I am trying to use GNUPLOT in Cygwin, however whenever I start it up it just
says the terminal type is unknown and then when I try to plot something
simple like sin(x), nothing happens.

$ gnuplot

G N U P L O T
Version 4.4 patchlevel 0
last modified March 2010
System: CYGWIN_NT-6.1-WOW64 1.7.7(0.230/5/3)

Copyright (C) 1986-1993, 1998, 2004, 2007-2010
Thomas Williams, Colin Kelley and many others

gnuplot home: http://www.gnuplot.info
faq, bugs, etc:   type "help seeking-assistance"
immediate help:   type "help"
plot window:  hit 'h'

Terminal type set to 'unknown'
gnuplot> plot sin(x)
gnuplot>

Can anyone help me?  Thanks.
-- 
View this message in context: 
http://old.nabble.com/GNUPLOT-in-Cygwin%3A-Terminal-type-set-to-%27unknown%27-tp31001313p31001313.html
Sent from the Cygwin list mailing list archive at Nabble.com.


--
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