How can one use Boost with Eclipse?

15,078

Solution 1

After doing what I originally posted to install and configure Boost, follow these simple steps:

Go to Project Settings -> C/C++ Build -> Settings:

C++ Compiler -> Includes -> Include paths -> Add...

Add "(directory)\include\boost_x_xx"

C++ Linker -> Libraries -> Library search path -> Add...

Add "(target_directory)\lib"

C++ Linker -> Libraries -> Libraries -> Add...

Add (name of library without beginning "lib" or ending ".a")

For example: libboost_system-mgw49-mt-1_61.a becomes boost_system-mgw49-mt-1_61.

Solution 2

Try adding Boost to the Include and Library search paths.

Go to Project Settings -> C/C++ Build -> Settings:

  • C++ Compiler -> Includes -> Include paths -> Add...

    • Add "<target_dir>\include\boost_x_xx"
  • C++ Linker -> Libraries -> Library search path -> Add...

    • Add "<target_dir>\lib"
Share:
15,078
Evan Weissburg
Author by

Evan Weissburg

C++, Java, Python

Updated on June 28, 2022

Comments

  • Evan Weissburg
    Evan Weissburg almost 2 years

    I'm having a lot of trouble installing Boost for use with Eclipse C++ (compiler MinGW).

    I first tried downloading the zip at https://sourceforge.net/projects/boost/files/boost/1.61.0/. After it downloaded, I brought it to my second drive, extracted the files there, cd there, and then ran ./bootstrap.bat gcc, which appeared to run successfully.

    Then, I ran b2 install --prefix="D:\boostfiles" toolset=gcc and it took about 30 minutes to create a lot of files starting with bin.v2 and ending with rst.

    However, #include <boost/asio.hpp> still gives an error. Is there somewhere the files are supposed to be?

    For reference, my file structure includes the original boost_1_61_0 extracted folder, a folder that boost was installed to called boostfiles, and a folder called PFiles that includes both eclipse and MinGW.