I am trying to implement gsl_rng.h on a Montecarlo simulation on my MacBook Pro (13-inch, Mid 2012). The simulation is all written in C. My problem is that gcc-6 complains it cannot find the gsl library despite the compilation flags which I think are fine.
The top of declare.h, which is included in all .c files I am working on:
/* __________________ LIBRARIES ___________________*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <gsl/gsl_rng.h>
The error:
fatal error: gsl/gsl_rng.h: No such file or directory
The compilation flags included in my makefile:
INCLUDE = -I/usr/local/Cellar/gsl/2.4/include
LINK = -L/usr/local/Cellar/gsl/2.4/lib -lgsl -lgslcblas
I installed both gcc-6 and gsl via Homebrew.
How can I make gcc-6 find gsl? Are my flags wrong?
The makefile:
CC = g++-6
CFLAGS = -lm -O3 -ansi -pedantic -Wall -Wextra\
-Wconversion -Wredundant-decls -fmax-errors=7\
-Wunsafe-loop-optimizations -Wmissing-braces\
-Wparentheses
# -Wdouble-promotion
INCLUDE = -I/usr/local/Cellar/gsl/2.4/include
LINK = -L/usr/local/Cellar/gsl/2.4/lib -lgsl -lgslcblas
../bin/bidimensional_MC: random.o functions.o subroutines.o\
main.o
$(CC) -o ../bin/bidimensional_MC random.o functions.o\
subroutines.o main.o $(CFLAGS) $(LINK) $(INLCUDE)
random.o: random.c
$(CC) -c random.c -lm -O3 $(CFLAGS) $(INCLUDE)
functions.o: functions.c
$(CC) -c functions.c $(CFLAGS) $(INCLUDE)
main.o: main.c
$(CC) -c main.c $(CFLAGS) $(INCLUDE)
suboutines.o: subroutines.c
$(CC) -c subroutines.c $(CFLAGS) $(INCLUDE)
clean:
rm *.o
The output of ls /usr/local/Cellar/gsl/2.4/include/gsl/
is:
/usr/local/Cellar/gsl/2.4/include/gsl/gsl_rng.h
The output of ls /usr/local/Cellar/gsl/2.4/include/
is:
gsl/
The output of ls /usr/local/Cellar/gsl/2.4/include/gsl/
is too long to post, but everything is there, as it should.
EXTRA INFORMATION: I am using g++-6 instead of gcc-6 because the cluster in which I'm going to finally execute the simulation requires code to be C++ compliant.