Menu

Linear Algebra Libraries with Dev

2008-09-24
2012-09-26
  • Chris Hammond

    Chris Hammond - 2008-09-24

    I'm using Dev C++ 4.9.9.2 on Windows XP. Rather than reinventing the wheel, I want to download a library that has all of the standard tools from linear algebra. Apparently the standard is thing is Lapack. I don't know how to set Lapack up to work with Dev C++. I was wondering if anyone could help with this problem. Alternatively, if you know of something else that works, I would love to hear about that.

    Thanks,

    Chris

     
    • Chris Hammond

      Chris Hammond - 2008-09-24

      Thanks. It works now. I should have paid closer attention. The necessity of this was pointed out in the page where the package was available to download.

       
    • cpns

      cpns - 2008-09-24

      The GNU Scientific Library http://en.wikipedia.org/wiki/GNU_Scientific_Library supports linear algebra. There is a DevPak for it at http://www.devpaks.org/details.php?devpak=91 or via the Tools->Check for updates and packages menu in Dev-C++ (select DevPaks.org server).

      Clifford

       
    • Chris Hammond

      Chris Hammond - 2008-09-24

      I downloaded and installed GSL at the link you provided, but when I try to run a simple test program, I get the following error. I checked, and the include file gsl/gsl_sf_bessel.h is where it should be.

      include <cstdlib>

      include <iostream>

      include <gsl/gsl_sf_bessel.h>

      using namespace std;

      int main(int argc, char *argv[])
      {

      double x = 5.0;
         double y = gsl_sf_bessel_J0 (x);
      
      system(&quot;PAUSE&quot;);
      return EXIT_SUCCESS;
      

      }

      Compiler: Default compiler
      Building Makefile: "C:\Dev-Cpp\Getting Started\GSL_Test\Makefile.win"
      Executing make...
      make.exe -f "C:\Dev-Cpp\Getting Started\GSL_Test\Makefile.win" all
      g++.exe GSL_TestMain.o -o "GSL_Test.exe" -L"C:/Dev-Cpp/lib"

      GSL_TestMain.o(.text+0x13a):GSL_TestMain.cpp: undefined reference to `gsl_sf_bessel_J0'
      collect2: ld returned 1 exit status

      make.exe: *** [GSL_Test.exe] Error 1

      Execution terminated

       
    • Wayne Keen

      Wayne Keen - 2008-09-24

      Thanks for posting your log! You have no idea how much easier that makes the process. It earns you a LOT of good will as well.

      The reason you got that error is simply this - you did not link the appropriate GSL library.
      This is going to be something you need to expect to do when you are using a tool like GSL - you will need to include the appropriate header (this is like providing the menu), AND link the right library (this is like providing the food).

      There is a section in the thread titled "Please Read Before Posting a Question", on the compile log, including headers and linking libraries that covers the process for linking.

      Two other notes

      (1) There are occasional problems reported with projects placed in the Dev-CPP directory. I keep mine in c:\dev-cpp

      (2) Directories with spaces in them are problematic. (like "Getting Started") They can lead to errors that suddenly appear. Don't do it.

      Wayne

       
      • Wayne Keen

        Wayne Keen - 2008-09-24

        A clue to when you have the library linked - you may see something in the log that looks like

        -lgsl

        where that is a small letter L in front.

        Wayne

        p.s. I posted some stuff on GSL here several years ago,it might still be about

         
    • cpns

      cpns - 2008-09-24

      This line:
      > g++.exe GSL_TestMain.o -o "GSL_Test.exe" -L"C:/Dev-Cpp/lib"

      is the command line that invokes the linker. It shows that you have not linked the GSL library. The DevPak will have installed it somewhere, probably in "C:/Dev-Cpp/lib", that being the case you need to add -lgsl to the project linker options. This will cause the library archive "libgsl.a" to the linked.

      If it was installed elsewhere you will need to add the path to the project's library directories list (this will create an additional -L<path> on the command line. You can also specify the ibrary with a fully qualified path and filename; there is a button for that in the project options dialog.

      On another issue, don't put your projects here: "C:\Dev-Cpp\Getting Started", the path is a sub-folder of the Dev-C++ installation folder and it contains spaces. Both of these can cause problems. Move it to say "C:\projects\getting_started\" for example.

      Clifford

       

Log in to post a comment.