[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-gsl] Linking GSL [noob]
From: |
Fg Nu |
Subject: |
[Help-gsl] Linking GSL [noob] |
Date: |
Fri, 19 Oct 2012 05:33:57 -0700 (PDT) |
Hello all,
Earlier today, I posted a question to Stack Overflow
http://stackoverflow.com/q/12968355/1414455
but did not get an appropriate response. I believe this has to do with a basic
misunderstanding of the linking process.
1) For example, here is "fitting2.c" from the "/doc/examples/" folder and it
has the include directives
//--------------------------------------------------------------------------------------
#include <stdio.h>
#include <gsl/gsl_multifit.h>
//--------------------------------------------------------------------------------------
Since my GCC installation lives in
"E:\programming\c\libraries\gsl-1.15.tar\gsl-1.15", I changed the directive to
//--------------------------------------------------------------------------------------
#include <gsl-1.15/multifit/gsl_multifit.h>
//--------------------------------------------------------------------------------------
My first question is that is this the correct way to include the header file?
When I compile it with gcc, I obviously get a linking error:
gcc -Wall fitting2.c
gcc -Wall fitting2.c
fitting2.c:2:44: fatal error: gsl-1.15/multifit/gsl_multifit.h: No such file or
directory
compilation terminated.
2) I then created a makefile for this as follows
#============================================
CC=gcc
CFLAGS=-c -Wall -IE:/programming/c/libraries/gsl-1.15.tar/
LDFLAGS= -LE:/programming/c/libraries/gsl-1.15.tar/
LIBS= -lgsl
SOURCES=fitting2.c
OBJECTS=$(SOURCES:.c=.o)
EXECUTABLE=fitting2
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@
.c.o:
$(CC) $(CFLAGS) $< -o $@
#============================================
but this terminated with the following error
make
gcc -c -Wall -IE:/programming/c/libraries/gsl-1.15.tar/ -c -o fitting2.o
fitting2.c
process_begin: CreateProcess((null), gcc -c -Wall
-IE:/programming/c/libraries/gsl-1.15.tar/ -c -o fitting2.o fitting2.c, ...)
failed.
make (e=2): The system cannot find the file specified.
make: *** [fitting2.o] Error 2
I am not sure what I am doing wrong exactly.
I am using GCC 2.7.0 (MinGW) on 64-bit Windows.
Thanks.
- [Help-gsl] Linking GSL [noob],
Fg Nu <=