Menu

GSL + Devcpp

tstudent
2005-05-24
2012-09-26
  • tstudent

    tstudent - 2005-05-24

    Hi, i'm new.
    I have to compile a code like this:

    include <stdlib.h>

    include <stdio.h>

    include <gsl/gsl_rng.h>

    include <gsl/gsl_histogram.h>

    include <gsl/gsl_cdf.h>

    include <gsl/gsl_randist.h>

    I receive "Linker error"
    I have dowloaded this file:
    http://sourceforge.net/project/showfiles.php?group_id=23617&package_id=19804 and istalled in c:\Programmi\GnuWin32\
    Then i copied all files in "c:\Programmi\GnuWin32\include\gsl\" to c:\Dev-Cpp\include\gsl\
    Then i copied "c:\Programmi\GnuWin32\include\config.h" to "c:\Dev-Cpp\include\config.h"
    Then i copied "c:\Programmi\GnuWin32\lib\libgsl.a" to "c:\Dev-Cpp\lib\libgsl.a"

    What i have to do now?
    Thanks a lot

     
    • Nobody/Anonymous

      Wayne,

      Because I am not used to install anything in the DevCpp directory.
      Any new file, not belonging to the DevCpp installation package, goes to

      C:\C\include if is a .h file
      C:\C\lib if it is a dll or .a file
      C:\C\Help is it is a .chm or doc file

      and so on.

      (Unpacking the DevPack in a separate PC and copying the files )

      Then I will specify the directories or the required libs
      in the compilation option.

      Anyway I compiled your example and it is running without any problem (I have no gsl.dll).

      To be very clear...

      the include files and the two .a files (gsl and blas) are enough. No dll is strictly required. I have a lot of apps using gsl and I never used or installed the dll.

      Basically I would compile my apps with the gsl statically. So I never installed any dll library related to gsl.

      Anyway if anybody wants the dlls, they are in
      http://gnuwin32.sourceforge.net/packages/gsl.htm

      It is the original site from which the devpack was created. The dlls are available in the binaries.

      Max

       
    • Wayne Keen

      Wayne Keen - 2005-05-24

      Max,

      I tried one more time. I cleanly uninstalled Dev, removing everything. I wanted to clean out anything that might confuse matters from using the GSL I built.

      I then install Dev 4.9.9.2. I re-downloaded the Dev-Pack you linked. I double clicked the Dev-Pack, and it installed successfully. (I let it install where it wanted). This is the only Dev-Pack installed.

      I then loaded the program I posted earlier. I did it both as a single file, and as a project. In each case, I added

      -lgsl

      to my linker commands to link the gsl library. The code compiled in both cases successfully. At runtime, I got an error message stating it could not find libgsl.dll

      Note that there was nothing I did that would have created a need to have the dll in question.

      I have used GSL for a couple of years now, mainly for things like Bessel functions and random numbers, so I think I have a clue what I am doing with respect to this tool.

      The only conclusion I can draw is that the Dev-Pack in question is not reliable for all setups. Maybe its pulling something from my stand-alone MinGW/MSYS (I have seen that happen before, even when it was not in the path), maybe something from my Cygwin installation. I really don't know.

      All I can say is that the Dev-Pack does not work here. And, in an unusual twist for me, I honestly think its the Dev-Pack that has a problem, not me. (I almost NEVER say that :-) But I have told you everything that I did. Not much to screw up there.

      The GSL I built by the way with MinGW/MSYS was built with GCC-3.4.2 - that is what my stand alone MinGW has - and it does work.

      Wayne

       
    • Nobody/Anonymous

      Wayne,

      I believe in your words.
      All I can say is that the Dev-Pack does work here.

      Have you tried

      gcc.exe main.o -o "Project1.exe" -L"C:/Dev-Cpp/lib" ../../lib/libgsl.a

      (using your path and lib location)
      instead of -lgsl?

      I don't have the devcpp available now
      ( I am using a linux box) tomorrow I will try to link with -lgsl.

      Max

       
      • Wayne Keen

        Wayne Keen - 2005-05-24

        I am about to leave work in a few minutes for the long commute home. I have things on my laptop - so I should be able to try it this evening, be the good lord willing and the Creek don't rise...

        I do know it compiles successfully and runs OK with the same commands with the version I built, but we will see...

        Wayne

         
      • Nobody/Anonymous

        I managed to use GLS devpack only when I linked both libgsl.a and libgsl.dll.a.

         
    • Nobody/Anonymous

      You need to link the libraries you need. I believe you can do this via Project Options and that instructions are in the Forum FAQ

       
    • Nobody/Anonymous

      Hi

      Does it work now ?
      Are you working with Linux ?

      I'm new too.
      My Devcpp is installed on Windows XP.
      Now I need to use GSL but it does not work.

      Question:
      Is it possible to use GSL on Windows XP/Devcpp ?
      How ?

      Thanks a lot

       
    • Nobody/Anonymous

      In few words: Yes is possible.

      How?

      Get the package GLS from www.devpaks.org (mathematics section)
      and install it ! Very simple.

      Max

       
      • Wayne Keen

        Wayne Keen - 2005-05-24

        Note that I tried a couple of things this morning.

        (1) I downloaded the DevPack from the community devpack site through WebUpdate. Code compiled but did not run because of a missing dll

        (2) My "old fashioned" way of doing my own build from source with MinGW/MSYS still works. I build it in MSYS, and copy the files from the bin.lib and include directories over. It builds with the classic

        ./configure
        make
        make install

        dance. More involved that a DevPack to be sure.

        Wayne

         
        • Wayne Keen

          Wayne Keen - 2005-05-24

          Max,

          I downloaded and installed the DevPack at the link location you gave. It too appears to be mispackaged.

          The following code compiles successfully:

          include <stdio.h>

          include<stdlib.h>

          include <gsl/gsl_sf_bessel.h>

          int main(void)
          {
          double x = 1.64 * 3.1415926;

          double y = 4.0 * (gsl_sf_bessel_J1(x)/ x) * (gsl_sf_bessel_J1(x)/ x);
          
          printf(&quot;Y = %.10e\n&quot;,y);
          
          system(&quot;pause&quot;);
          
          return 0;
          

          }

          Here is the log:

          Compiler: Default compiler
          Compiler: Default compiler
          Executing gcc.exe...
          gcc.exe "C:\cstuff\gsltest.c" -o "C:\cstuff\gsltest.exe" -lgsl -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
          Execution terminated
          Compilation successful

          Note that I did link gsl....

          But the code will not run because it looks for libgsl.dll that is not present.

          Wayne

           
    • Wayne Keen

      Wayne Keen - 2005-05-24

      I re-verified after posting the post above that the above code does in fact run fine with my self-built gsl libraries, compiling with the same options, adding only

      -lgsl

      to my linker commands.

      Wayne

       
    • Nobody/Anonymous

      Basically my gsl installation is based on the DevPack from www.devpaks.org.

      I got the include files and the static lib. It is enough.
      I am not using the dll for gsl.

      For example the posted code

      include <stdio.h>

      include<stdlib.h>

      include <gsl/gsl_sf_bessel.h>

      int main(void)
      {
      double x = 1.64 * 3.1415926;

      double y = 4.0 * (gsl_sf_bessel_J1(x)/ x) * (gsl_sf_bessel_J1(x)/ x);

      printf("Y = %.10e\n",y);

      system("pause");

      return 0;
      }

      is compiled successfully.

      Hereafter the log:

      Compiler: Default compiler
      Building Makefile: "C:\C\Projects\testgsl\Makefile.win"
      Executing make clean
      rm -f main.o Project1.exe

      gcc.exe -c main.c -o main.o -I"C:/Dev-Cpp/include" -I"C:/C/include/gsl"

      gcc.exe main.o -o "Project1.exe" -L"C:/Dev-Cpp/lib" ../../lib/libgsl.a

      Execution terminated
      Compilation successful

      The program runs correctly.

      Hope this helps

      Max

       
      • Wayne Keen

        Wayne Keen - 2005-05-24

        As I stated earlier in my posts, I found code compiled with the DevPack DOES compile successfully. It does NOT however RUN. It generates an error message about needing the dll I mentioned, and quits.

        Wayne

         
        • Wayne Keen

          Wayne Keen - 2005-05-24

          By the way, the build I did of GSL does not create a dll either. Something in the packaging of the Dev-Pack is causing it to look for a dll.

          Wayne

           
          • Wayne Keen

            Wayne Keen - 2005-05-24

            Max,

            By the way, why do you have this in your include search path?

            -I"C:/C/include/gsl"

            The Dev_Pack did not put anything on my machine in c:\c:\include\gsl

            Wayne

             

Log in to post a comment.

Auth0 Logo