Author Topic: Code::Blocks and Gnu Scientific Library (GSL)  (Read 359 times)

Offline tuuk

  • Single posting newcomer
  • *
  • Posts: 3
Code::Blocks and Gnu Scientific Library (GSL)
« on: March 10, 2017, 08:16:52 am »
I am teaching C++ and I am using Code::Blocks as the IDE. I would like to give a project to my students that requires Gnu Scientific Library (GSL). What is the best (and, preferably, platform independent) solution to incorporating GSL to a project? Hopefully, a simple set of instructions would work, as not all of my students are very proficient yet.
Windows, Macs, and Linux are all used by my students.

I have thought that downloading the GSL source code and adding the directory of the GSL (recursively) to the project would do the job. But for reasons I don't quite understand, I couldn't get it to work. The library headers and source files are listed under the project, but the compilation gets terminated early on. It is failing to locate header files in the first place.

Any suggestions and pointers will be much appreciated.
Thanks,
tuuk

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 9870
Re: Code::Blocks and Gnu Scientific Library (GSL)
« Reply #1 on: March 10, 2017, 08:50:31 am »
You'll probably have to adjust the project search paths to match what the original GSL build system is doing.
<debugger plugin maintainer>
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline tuuk

  • Single posting newcomer
  • *
  • Posts: 3
Re: Code::Blocks and Gnu Scientific Library (GSL)
« Reply #2 on: March 10, 2017, 12:32:25 pm »
Thanks, oBFusCATed. That suggestion improved the situation a little bit. By adding the top level directory for the GSL library in the "Search Directories", I can get the headers in that top directory seen. But the library tree is organised in a way that some headers are in many different  subfolders, and it does not look like those subfolders are searched recursively. I cannot see a switch to make that happen. Is there a simple fix to this?

Also, on a unrelated issue, some header in the library includes
#include <config.h>
which I suppose should be in the standard C/C++ library, but the compiler cannot find it (even after I installed "libconfig-dev" package on my Ubuntu box). Does anyone know about this?

Thanks in advance.
tuuk

Online stahta01

  • Lives here!
  • ****
  • Posts: 5709
    • My Best Post
Re: Code::Blocks and Gnu Scientific Library (GSL)
« Reply #3 on: March 10, 2017, 04:25:19 pm »
http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

Edit: Once you figure out how to post a build log. I suggest posting your question on https://cboard.cprogramming.com/forum.php

This reason for this suggestion is the rules for this site http://forums.codeblocks.org/index.php/topic,9996.0.html

I am just a frequent poster to this site; I am NOT a CB Dev or Site Admin person.

NOTE: One set of directions will likely NOT be possible!
3 Sets, one each for Linux, Windows, and Mac might be possible.

Tim S.
« Last Edit: March 10, 2017, 04:30:52 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline sodev

  • Multiple posting newcomer
  • *
  • Posts: 58
Re: Code::Blocks and Gnu Scientific Library (GSL)
« Reply #4 on: March 10, 2017, 04:39:59 pm »
Don't build GSL with CodeBlocks, build it by the means it provides. It probably uses automake and other magic, might be a ton of work to build it with CodeBlocks. Don't try to build external libraries with your IDE, build your own application with it and just link the build library.

Online stahta01

  • Lives here!
  • ****
  • Posts: 5709
    • My Best Post
Re: Code::Blocks and Gnu Scientific Library (GSL)
« Reply #5 on: March 10, 2017, 04:54:28 pm »
Don't build GSL with CodeBlocks, build it by the means it provides. It probably uses automake and other magic, might be a ton of work to build it with CodeBlocks. Don't try to build external libraries with your IDE, build your own application with it and just link the build library.

This is correct and the easiest way for C external Libraries.

It is normally still the correct way for C++  external Libraries; but, it may NOT be the easiest way for C++ external Libraries.

Tim S.
 
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline tuuk

  • Single posting newcomer
  • *
  • Posts: 3
Re: Code::Blocks and Gnu Scientific Library (GSL)
« Reply #6 on: March 10, 2017, 05:24:00 pm »
Thanks, stahta01 and sodev, for the clarifications, suggestions, and the warning about my misuse of the current forum.

I had hoped that I can give my students a simple set of directions (such as the ones I was able to give previously under Dev-C++ using devpak package for SGL). It looks like it is not going to be that straightforward.

Cheers,
tuuk