Author Topic: [solved] A problem with setting up boost  (Read 11343 times)

Offline Nelarius

  • Single posting newcomer
  • *
  • Posts: 4
[solved] A problem with setting up boost
« on: January 18, 2012, 07:23:40 pm »
Hi!

I'm new to Code::Blocks and haven't had to set up libraries up before. I'm trying to get boost up and running (I was using this tutorial) but i've been running into problems. My Code::Blocks doesn't seem to recognize where my boost folder is located. So this

Code
#include <boost/numeric/ublas/matrix.hpp>

leads to
Code
fatal error: boost/numeric/ublas/matrix.hpp: No such file or directory
when I try to build the project.

I'm using Code::Blocks with windows and MinGW. What I've currently done:

I've created a global variable called boost and set the base field to the root of where I installed boost.
Currently in my project build options:
Search directories: Compiler: C:\Boost\include
Search directories: Linker: C:\Boost\lib

As for what link libraries to include, I'm not sure... As far as I understand I don't always need to put anything there as it depends on what is included?

I originally put $(#boost) and $(#boost.lib) into the search directory boxes as per the tutorial, but the outcome was the same. Help would be appreciated!
« Last Edit: January 18, 2012, 10:50:29 pm by Nelarius »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: A problem with setting up boost
« Reply #1 on: January 18, 2012, 07:36:06 pm »
Search directories: Compiler: C:\Boost\include
Search directories: Linker: C:\Boost\lib
I am not sure about the "lib" folder, but no boost I know does have a sub-folder named "include". Setup the path correctly.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Nelarius

  • Single posting newcomer
  • *
  • Posts: 4
Re: A problem with setting up boost
« Reply #2 on: January 18, 2012, 08:16:34 pm »
Interesting, because mine does. ??? I actually tinkered with that folder, as the headers were initially in ...\include\boost-1_48\boost\. I wonder if I have installed boost correctly then?

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: A problem with setting up boost
« Reply #3 on: January 18, 2012, 08:38:35 pm »
Interesting, because mine does. ??? I actually tinkered with that folder, as the headers were initially in ...\include\boost-1_48\boost\. I wonder if I have installed boost correctly then?
If you have moved files manually your installation is most likely broken.
The most secure way to fix this is to re move boost and reinstall it.

You should use the path containing the boost-subfolder as base for the global compiler var (in your case [\path\to]\boost-1_48) and use $(#boost) as (one of the) compiler search dir(s).
That should fix at least the include-issue.
I never used a compiled version of boost (just some headers), so that's all I can help.

Offline Nelarius

  • Single posting newcomer
  • *
  • Posts: 4
Re: A problem with setting up boost
« Reply #4 on: January 18, 2012, 10:49:45 pm »
You should use the path containing the boost-subfolder as base for the global compiler var (in your case [\path\to]\boost-1_48) and use $(#boost) as (one of the) compiler search dir(s).
Ok, restored the old file structure and this did the trick. Seems to work for now :)

Thanks for your replies!

Offline void

  • Single posting newcomer
  • *
  • Posts: 7
Re: [solved] A problem with setting up boost
« Reply #5 on: January 20, 2012, 06:05:32 pm »
Also, you may want to check the architecture you're trying to build for. Recent MinGW versions (especially those from TDM) are supporting both 64 and 32 bit. If you don't pass -m32 as compiler and linker option, gcc will try to find x64 builds of the libraries that may not always be present.

I know you solved your problem already, but I thought it might be a good idea to have that information right here anyways.