[Dev-C++] linker error when cross compiling thru cygwin
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
From: Tim R. <tm...@al...> - 2008-07-14 18:52:38
|
hey all, I'm trying to use gsl to do some linear algebra, and right now I'm just trying to compile this example code from the gnu website: #include <stdio.h> #include <gsl/gsl_linalg.h> int main (void) { double a_data[] = { 0.18, 0.60, 0.57, 0.96, 0.41, 0.24, 0.99, 0.58, 0.14, 0.30, 0.97, 0.66, 0.51, 0.13, 0.19, 0.85 }; double b_data[] = { 1.0, 2.0, 3.0, 4.0 }; gsl_matrix_view m = gsl_matrix_view_array (a_data, 4, 4); gsl_vector_view b = gsl_vector_view_array (b_data, 4); gsl_vector *x = gsl_vector_alloc (4); int s; gsl_permutation * p = gsl_permutation_alloc (4); gsl_linalg_LU_decomp (&m.matrix, p, &s); gsl_linalg_LU_solve (&m.matrix, p, &b.vector, x); printf ("x = \n"); gsl_vector_fprintf (stdout, x, "%g"); gsl_permutation_free (p); gsl_vector_free (x); return 0; } I'm using a crosstool through cygwin to compile for an ARM processor. The compile log looks like this: Building Makefile: "C:\Documents and Settings\student\Desktop\sepatriot\spa pc\gsl-test\Makefile.win" Executing make... make.exe -f "C:\Documents and Settings\student\Desktop\sepatriot\spa pc\gsl-test\Makefile.win" all arm-unknown-linux-gnu-gcc.exe test-gsl.o -o "gsl-test.exe" -L"C:/cygwin/opt/crosstool/gcc-3.3.4-glibc-2.3.2/arm-unknown-linux-gnu/lib" -L/cygdrive/c/cygwin/opt/crosstool//gcc-3.3.4-glibc-2.3.2/arm-unknown-linux-gnu/lib -L/cygdrive/c/cygwin/opt/crosstool//gcc-3.3.4-glibc-2.3.2/arm-unknown-linux-gnu/usr/include -lgsl -lm -lgslcblas Building Makefile: "C:\Documents and Settings\student\Desktop\sepatriot\spa pc\gsl-test\Makefile.win" Executing make... make.exe -f "C:\Documents and Settings\student\Desktop\sepatriot\spa pc\gsl-test\Makefile.win" all arm-unknown-linux-gnu-gcc.exe test-gsl.o -o "gsl-test.exe" -L"C:/cygwin/opt/crosstool/gcc-3.3.4-glibc-2.3.2/arm-unknown-linux-gnu/lib" -L"C:/cygwin/opt/crosstool/gcc-3.3.4-glibc-2.3.2/arm-unknown-linux-gnu/arm-unknown-linux-gnu/lib" -L"C:/cygwin/lib" -L/cygdrive/c/cygwin/opt/crosstool//gcc-3.3.4-glibc-2.3.2/arm-unknown-linux-gnu/lib -L/cygdrive/c/cygwin/opt/crosstool//gcc-3.3.4-glibc-2.3.2/arm-unknown-linux-gnu/usr/include -lgsl -lm -lgslcblas test-gsl.o(.text+0x60): In function `main': : undefined reference to `gsl_matrix_view_array' test-gsl.o(.text+0x78): In function `main': : undefined reference to `gsl_vector_view_array' test-gsl.o(.text+0x80): In function `main': : undefined reference to `gsl_vector_alloc' test-gsl.o(.text+0x90): In function `main': : undefined reference to `gsl_permutation_alloc' test-gsl.o(.text+0xac): In function `main': : undefined reference to `gsl_linalg_LU_decomp' test-gsl.o(.text+0xc4): In function `main': : undefined reference to `gsl_linalg_LU_solve' test-gsl.o(.text+0xe0): In function `main': : undefined reference to `gsl_vector_fprintf' test-gsl.o(.text+0xe8): In function `main': : undefined reference to `gsl_permutation_free' test-gsl.o(.text+0xf0): In function `main': : undefined reference to `gsl_vector_free' collect2: ld returned 1 exit status make.exe: *** [gsl-test.exe] Error 1 Execution terminated the reason that this confuses me is that I have the libraries stored in: C:\cygwin\lib and the includes for gsl in: C:\cygwin\usr\include. If anybody can help me out I will be eternally grateful. TMR |