Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can one use Boost with Eclipse?

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.

like image 390
Evan Weissburg Avatar asked Sep 04 '16 19:09

Evan Weissburg


1 Answers

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.

like image 139
Evan Weissburg Avatar answered Oct 13 '22 00:10

Evan Weissburg