Author Topic: How to install GSL "properly" in Code::Blocks  (Read 9923 times)

Offline Ronny_C

  • Single posting newcomer
  • *
  • Posts: 4
How to install GSL "properly" in Code::Blocks
« on: July 06, 2011, 11:56:26 pm »
I am a newbie to C++ and codeblock. I hit a question when I installed GSL in CodeBlocks. I have already read this thread http://forums.codeblocks.org/index.php/topic,13375.0.html. I follow the idea suggested in the post  right click project -> build options -> Search Directories tab -> under complier, linker and resource complier, I add the following paths:

C:\Program Files\GnuWin32\src\gsl\1.8\gsl-1.8
C:\Program Files\GnuWin32\include\gsl
C:\Program Files\GnuWin32\contrib\gsl\1.8\gsl-1.8
C:\Program Files\GnuWin32\info
C:\Program Files\GnuWin32\doc\gsl\1.8\gsl-1.8

Then I run my testing code
#include <iostream>
 #include <stdio.h>
 #include <gsl_sf_bessel.h>  /
 #include <gsl_mode.h>
using namespace std;
     int
     main (void)
     {
       double x = 5.0;
       double y = gsl_sf_bessel_J0 (x);
       printf ("J0(%g) = %.18e\n", x, y);
       return 0;
     }

there was no error message for calling the header gsl_sl_bessel.h because this file poped out in code::block console; however, more error messages came  out  saying that the system couldn't find header files which were called by gsl_sl_bessel.h. Does anyone has a clue how to solve the problems. thanks
« Last Edit: July 06, 2011, 11:58:55 pm by Ronny_C »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7785
    • My Best Post
Re: How to install GSL "properly" in Code::Blocks
« Reply #1 on: July 07, 2011, 12:13:55 am »
Why did you NOT add this one under the Compiler Search Directories?
Code
C:\Program Files\GnuWin32\include


Quote
How to install GSL "properly" in Code::Blocks

An more accurate title would be how to setup an Code::Blocks project to use the GSL Library.

Turn on Full Compiler Logging, in order for your to learn what Code::Blocks sends to the Compiler.

Tim S.
« Last Edit: July 07, 2011, 12:21:47 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Ronny_C

  • Single posting newcomer
  • *
  • Posts: 4
Re: How to install GSL "properly" in Code::Blocks
« Reply #2 on: July 07, 2011, 04:17:18 pm »
Thanks a lot, Stahta01. After following your advice and looking up the wiki.codeblocks.org, I found a solution to set the search paths grobally in the option called Complier and degugger. Then I set a full debugger mode in CodeBlocks, it seemed the problem finding header file disappeared; however, there was a problem when I called the function. I used the command call find declaration of "Function" by right click on the target function, let say gsl_sf_bessel_J0. The header file which the function was declared there came out and gave a proper location (exact line number) of the function. Then I used the command called find the implementation of "Function", no file came out on the computer screen but a message saying no such file existed. Does anyone have a clue how to solve it? Thanks!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: How to install GSL "properly" in Code::Blocks
« Reply #3 on: July 07, 2011, 04:22:46 pm »
You've done the wrong thing - library setting should not be set in the global compiler settings, they should be set in the project's build options instead.

p.s. read about global variables they are very useful...
(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 Ronny_C

  • Single posting newcomer
  • *
  • Posts: 4
Re: How to install GSL "properly" in Code::Blocks
« Reply #4 on: July 07, 2011, 04:46:29 pm »
I have done what you have suggested. I got no sign to get rid fo my problem. Regarding to your Global variables. I wonder if you could give me more hits please.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: How to install GSL "properly" in Code::Blocks
« Reply #5 on: July 07, 2011, 04:53:57 pm »
Search the wiki about them... (global variables)

p.s. adding search paths to the compiler works, but your project is not transferable to other computers.
(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 Ronny_C

  • Single posting newcomer
  • *
  • Posts: 4
Re: How to install GSL "properly" in Code::Blocks
« Reply #6 on: July 07, 2011, 06:58:30 pm »
Thanks for faith4of9the5heart. Here is the solution.
http://www.youtube.com/watch?v=vLEwb8UKO2c