Author Topic: Yet Another Newbie Who Can't Configure Boost (YANWCCB)  (Read 7355 times)

Offline dllabs

  • Single posting newcomer
  • *
  • Posts: 3
Yet Another Newbie Who Can't Configure Boost (YANWCCB)
« on: April 12, 2013, 05:04:12 am »
I know this has been asked and answered before, but I have followed all the answers I can find and I *still* can't configure Boost for the libraries that need special linking, such as (in my case) filesystem. Whenever I go to compile I get this error first up:
fatal error: boost/filesystem/operations.hpp: No such file or directory

Now, here are the steps I have taken.
  • 1) I built Boost with GCC as follows:
    • I downloaded Boost and unzipped it to C:\projects\boost_1_53_0
    • I went into C:\projects\boost_1_53_0\tools\build\v2\engine and ran "build.bat gcc" to create C:\projects\boost_1_53_0\tools\build\v2\engine\bin.ntx86\bjam.exe
    • I added C:\projects\boost_1_53_0\tools\build\v2\engine\bin.ntx86 to my path
    • I went back into C:\projects\boost_1_53_0 and, worried that the bjam.exe in that directory might run, I renamed it to old.bjam.exe
    • I ran 'bjam --toolset=gcc "--prefix=C:\projects\boost" install', as you may note, installing Boost in a different directory from the download directory. This created C:\projects\boost\lib and C:\projects\boost\include
  • 2) In Codeblocks 12.11 (Windows 8 64 bit) I configured the following:
    • In Settings|Global variables I created a variable "boost" with:
      • base = C:\projects\boost
      • include = C:\projects\boost\include\boost-1_53\
      • lib = C:\projects\boost\lib
    • I created a new Project called "Boost" with these settings:
      • In the project's "Build options I added "$(#boost)" (no quotes)  to the "Compiler" box of the "Search directories" tab for the project root.
      • In the project's "Build options I added "$(#boost)" (no quotes)  to the "Linker" box of the "Search directories" tab for the project root. I don't think this is needed but I did it anyway
      • In the project's "Buildoptions" I added "boost_filesystem-mgw47-mt-1_53" (no quotes) to the "Link libraries" box of the "Linker settings" tab.
  • 3) I created a file that contained the Boost test program "simple_ls". It contains the following preprocessor instructions:
    #define BOOST_FILESYSTEM_NO_DEPRECATED

    #include "boost/filesystem/operations.hpp"
    #include "boost/filesystem/path.hpp"
    #include "boost/progress.hpp"
    #include <iostream>
  • 4) I hit F9 and the compiler hung on '#include "boost/filesystem/operations.hpp"' ???

The file operations.hpp does exist, in C:\projects\boost\include\boost-1_53\boost\filesystem\

Where did I go wrong?

thanks in advance

John

 
 
« Last Edit: April 12, 2013, 05:06:42 am by dllabs »

Offline dllabs

  • Single posting newcomer
  • *
  • Posts: 3
Re: Yet Another Newbie Who Can't Configure Boost (YANWCCB)
« Reply #1 on: April 12, 2013, 05:22:13 am »
I fixed it! I had the search variable as $(#boost) but it needs to be $(#boost.include).
In my next reply I will show my step by step, with the correction, in the hope it helps the next person out.

« Last Edit: April 12, 2013, 05:26:35 am by dllabs »

Offline dllabs

  • Single posting newcomer
  • *
  • Posts: 3
Re: Yet Another Newbie Who Can't Configure Boost (YANWCCB)
« Reply #2 on: April 12, 2013, 05:24:57 am »
  • 1) I built Boost with GCC as follows:
    • I downloaded Boost and unzipped it to C:\projects\boost_1_53_0
    • I went into C:\projects\boost_1_53_0\tools\build\v2\engine and ran "build.bat gcc" to create C:\projects\boost_1_53_0\tools\build\v2\engine\bin.ntx86\bjam.exe
    • I added C:\projects\boost_1_53_0\tools\build\v2\engine\bin.ntx86 to my path
    • I went back into C:\projects\boost_1_53_0 and, worried that the bjam.exe in that directory might run, I renamed it to old.bjam.exe
    • I ran 'bjam --toolset=gcc "--prefix=C:\projects\boost" install', as you may note, installing Boost in a different directory from the download directory. This created C:\projects\boost\lib and C:\projects\boost\include
  • 2) In Codeblocks 12.11 (Windows 8 64 bit) I configured the following:
    • In Settings|Global variables I created a variable "boost" with:
      • base = C:\projects\boost
      • include = C:\projects\boost\include\boost-1_53\
      • lib = C:\projects\boost\lib
    • I created a new Project called "Boost" with these settings:
      • In the project's "Build options I added "$(#boost.include)" (no quotes)  to the "Compiler" box of the "Search directories" tab for the project root.
      • In the project's "Build options I added "$(#boost)" (no quotes)  to the "Linker" box of the "Search directories" tab for the project root. I don't think this is needed but I did it anyway
      • In the project's "Build options" I added "boost_filesystem-mgw47-mt-1_53" (no quotes) to the "Link libraries" box of the "Linker settings" tab.

This is a working (for me at least) example of linking built Boost libraries in a Code::Blocks project.

[/list]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 640
Re: Yet Another Newbie Who Can't Configure Boost (YANWCCB)
« Reply #3 on: April 12, 2013, 10:59:59 am »
You should add $(#boost.lib) to the linker search directories not just $(#boost). The reason it seems not to be needed is you are manually pointing to the libraries yourself (I don't know if there is another way with boost). But in case a search has to be made for the required libraries, linker will look into the wrong directory $(#boost). Therefore it should be $(#boost.lib).

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Yet Another Newbie Who Can't Configure Boost (YANWCCB)
« Reply #4 on: April 13, 2013, 06:12:26 pm »
I went into C:\projects\boost_1_53_0\tools\build\v2\engine and ran "build.bat gcc" to create C:\projects\boost_1_53_0\tools\build\v2\engine\bin.ntx86\bjam.exe
Well you just build the BOOST build system, but not boost itself, so it cannot work.
After building bjam (actually it should be b2), you need to build boost using this tool. an built of boost takes ~30min-1h, depending on your PC. With default settings it will create a "stage" folder including the libs to link against which you then need either to move or to "install". Consult the boost docs for details - its all explained very well there.
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