2
votes

Attempting to set up CodeBlocks and boost on Windows 7, 64-bit.

This is what I've tried...

http://wiki.codeblocks.org/index.php?title=BoostWindowsQuickRef

Downloaded and Installed CodeBlocks 12.11 to C:...

C:\CodeBlocks

Downloaded boost_1_53_0.zip and unzipped to C:\boost...

C:\boost\boost_1_53_0

Checked gcc from command line...

gcc --version gcc (tdm-1) 4.7.1 Copyright (C) 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

On commandline in boost folder, ran...

bjam --toolset=gcc "--prefix=C:\CodeBlocks" install

Completed without error.

Explorer tree...

  • C:\CodeBlocks\include\boost-1_53\boost\accumulators\
  • C:\CodeBlocks\include\boost-1_53\boost\algorithm\
  • C:\CodeBlocks\include\boost-1_53\boost...

  • C:\CodeBlocks\lib\libboost_atomic-mgw47-mt-1_53.a

  • C:\CodeBlocks\lib\libboost_atomic-mgw47-mt-d-1_53.a
  • C:\CodeBlocks\lib...

Opened CodeBlocks and set global variable...

boost

  • base - C:\CodeBlocks\include\boost-1_53\boost

  • lib - C:\CodeBlocks\lib

Create new project - Console application

#include <iostream>
using namespace std;

int main()
{
    cout << "Hello world!" << endl;
    return 0;
}

Compiles and runs OK.

Set build options -> Search Directories...

Compiler

  • $(#boost.include)

Linker

  • $(#boost.lib)

Use example from http://www.boost.org/doc/libs/1_47_0/more/getting_started/windows.html#build-a-simple-program-using-boost

#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>

int main()
{
    using namespace boost::lambda;
    typedef std::istream_iterator<int> in;

    std::for_each(
        in(std::cin), in(), std::cout << (_1 * 3) << " " );
}

Get this...

-------------- Clean: Debug in console_app (compiler: GNU GCC Compiler)---------------

Cleaned "console_app - Debug"

-------------- Build: Debug in console_app (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -fexceptions -g -c C:\dev\console_app\main.cpp -o obj\Debug\main.o C:\dev\console_app\main.cpp:1:35: fatal error: boost/lambda/lambda.hpp: No such file or directory compilation terminated. Process terminated with status 1 (0 minutes, 0 seconds) 1 errors, 0 warnings (0 minutes, 0 seconds)

Tried the following to no avail... #include

-------------- Build: Debug in console_app (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -fexceptions -g -c C:\dev\console_app\main.cpp -o obj\Debug\main.o C:\dev\console_app\main.cpp:2:27: fatal error: boost/regex.hpp: No such file or directory compilation terminated. Process terminated with status 1 (0 minutes, 0 seconds) 1 errors, 0 warnings (0 minutes, 0 seconds)

#include "C:\CodeBlocks\include\boost-1_53\boost\regex.hpp"

OR

#include "C:/CodeBlocks/include/boost-1_53/boost/regex.hpp"

-------------- Build: Debug in console_app (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -fexceptions -g -c C:\dev\console_app\main.cpp -o obj\Debug\main.o In file included from C:\dev\console_app\main.cpp:3:0: C:\CodeBlocks\include\boost-1_53\boost\regex.hpp:28:34: fatal error: boost/regex/config.hpp: No such file or directory compilation terminated. Process terminated with status 1 (0 minutes, 0 seconds) 1 errors, 0 warnings (0 minutes, 0 seconds)

1

1 Answers

0
votes

What you set your global variable $(#boost.include) to will impact on this.

Boost's own header files expect to have the compiler search directory given to them during compilation, so including boost using a direct path will not solve it.

Make sure your $(#boost.include) global variable in Code::Blocks is set to "C:\CodeBlocks\include\boost-1_53"