Re: [Dev-C++] linker error when cross compiling thru cygwin
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
From: Noel W. <nw...@ny...> - 2008-07-28 03:46:45
|
Hi All; I would like to compile and run a multithreaded cppluss program using pthread library how is this done. HYPERLINK "outbind://35/Wally_files/image001.gif" NWallen -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Tim Rambo Sent: Friday, July 18, 2008 8:24 AM To: Per Westermark Cc: dev...@li... Subject: Re: [Dev-C++] linker error when cross compiling thru cygwin Actually, if you look at the end of the compile log, I did. > 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/l ib" -L"C:/cygwin/opt/crosstool/gcc-3.3.4-glibc-2.3.2/arm-unknown-linux-gnu/a rm-unknown-linux-gnu/lib" -L"C:/cygwin/lib" -L/cygdrive/c/cygwin/opt/crosstool//gcc-3.3.4-glibc-2.3.2/arm-unknown-li nux-gnu/lib -L/cygdrive/c/cygwin/opt/crosstool//gcc-3.3.4-glibc-2.3.2/arm-unknown-li nux-gnu/usr/include -lgsl -lm -lgslcblas I've been thinking that its possible the library needs to be built using my crosstool, does this sound reasonable? have been attempting to get gsl built with my crosstool in cygwin. but I am having problems with that as well. >>> Per Westermark <pw...@ia...> 7/17/2008 8:11 PM >>> You don't specify what library to use. C and C++ do not automagically try all libraries, just because you add them in your search path. -L <directory> just tells the linker where to look for a library that you have explicitly included in the linking. There are a few exceptions, which allows the standard RTL to be linked without you specifying the name. If you somewhere in all the library directories you specified has a file named libgsl.a, then you should have had a -lgsl to tell the linker to make use of this gsl library. /pwm On Mon, 14 Jul 2008, Tim Rambo wrote: > 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/l ib" -L/cygdrive/c/cygwin/opt/crosstool//gcc-3.3.4-glibc-2.3.2/arm-unknown-li nux-gnu/lib -L/cygdrive/c/cygwin/opt/crosstool//gcc-3.3.4-glibc-2.3.2/arm-unknown-li nux-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/l ib" -L"C:/cygwin/opt/crosstool/gcc-3.3.4-glibc-2.3.2/arm-unknown-linux-gnu/a rm-unknown-linux-gnu/lib" -L"C:/cygwin/lib" -L/cygdrive/c/cygwin/opt/crosstool//gcc-3.3.4-glibc-2.3.2/arm-unknown-li nux-gnu/lib -L/cygdrive/c/cygwin/opt/crosstool//gcc-3.3.4-glibc-2.3.2/arm-unknown-li nux-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 > > > Internal Virus Database is out-of-date. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.11.2/931 - Release Date: 8/1/2007 4:53 PM Internal Virus Database is out-of-date. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.11.2/931 - Release Date: 8/1/2007 4:53 PM |