Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Ronny_C on July 06, 2011, 11:56:26 pm

Title: How to install GSL "properly" in Code::Blocks
Post by: Ronny_C 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
Title: Re: How to install GSL "properly" in Code::Blocks
Post by: stahta01 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.
Title: Re: How to install GSL "properly" in Code::Blocks
Post by: Ronny_C 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!
Title: Re: How to install GSL "properly" in Code::Blocks
Post by: oBFusCATed 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...
Title: Re: How to install GSL "properly" in Code::Blocks
Post by: Ronny_C 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.
Title: Re: How to install GSL "properly" in Code::Blocks
Post by: oBFusCATed 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.
Title: Re: How to install GSL "properly" in Code::Blocks
Post by: Ronny_C on July 07, 2011, 06:58:30 pm
Thanks for faith4of9the5heart. Here is the solution.
http://www.youtube.com/watch?v=vLEwb8UKO2c