Adding Boost Library to a C++ project in OS X Eclipse

前端 未结 5 620
無奈伤痛
無奈伤痛 2021-02-06 02:41

I am have been attempting to get a C++ project setup using boost file system library using eclipse. I followed these directions to install boost on my system. The directions whe

5条回答
  •  清酒与你
    2021-02-06 03:08

    Just wanted to be clear on what actually worked, since it was kinda pieced together from a few answers.

    1. Download the boost files and extract them to where you want to put them.
    2. In your terminal navigate to the directory and run ./bootstrap.sh
    3. When that is done run ./bjam (this takes a while so go smoke and get a cup of coffee)
    4. Open up your eclipse Project and go to Project > Properties > C/C++ Build > Settings
    5. Click on MacOS X C++ Linker > Libraries. You should see a split window with the top being for 'Libraries (-l)'. In this section add both boost_system and boost_filesystem. In the bottom section it should be for 'Library Search Path (-L)'. Here you want to put the path to the stage/lib directory inside where you extracted the boost download. It should look similar to below:alt text
    6. Click GCC C++ Compiler > Includes. This will be a single pane where it says 'Include Paths (-I)', well I think it is an I as he font is weird and could be a lower case l also. Anyway in that section add the path to where you put boost without the stage/lib part. It should look like below:alt text

    Everything should compile now with out a problem, and if you need to use any other boost libraries it should be just a matter of adding it to the linker section where boost_filesystem and boost_system are. Enjoy.

提交回复
热议问题