Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

boost headers not found issue in mac os x

While including boost headers, I am getting not found error like the following-

 fatal error: boost/config.hpp: No such file or directory
 #include <boost/config.hpp>

I am using Mac OS X 10.9, and installed boost through brew. I can see all the boost headers at /usr/local/include/boost folder. How can I solve this problem?

Thanks in advance.

like image 923
Morison Avatar asked Jan 21 '15 23:01

Morison


3 Answers

Assuming that /usr/local/include/boost/config.hpp exists, you need to add /usr/local/include to the compiler include search path; for gcc you can do this by adding -I /usr/local/include to the command line (or relevant part of the makefile).

What compiler are you using, and did you install it via homebrew?

like image 168
Phil Lello Avatar answered Nov 07 '22 16:11

Phil Lello


  • make sure to use the right compiler - just gcc gets the wrapper around Apple's clang, /usr/local/bin/gcc-4.9 is what you installed with brew
  • did you add an -I /usr/local/include to your compilation?
  • as already written, a full dump of the error message would be helpful
like image 2
schroder Avatar answered Nov 07 '22 17:11

schroder


Goto the following folder and find the installed boost library folder. I paste mine as an example folder path;

/usr/local/Cellar/boost/1.67.0_1

You need to find the most recent boost folder. If not there, you should install the boost library via brew

brew install boost

I'm assuming that you are using Xcode for your project. After the preceding steps, you need to add correct boost folder paths to your Xcode project. Open your Xcode project goto "Header Search Paths" and add the boost folder's parent folder path. Check the screenshot that I attached (ss-1 ss-1).

e.g. /usr/local/Cellar/boost/1.67.0_1/include/ for the Header Search Paths (ss-2 ss-2)

Also, you need to add Library Search Paths in your Xcode project. e.g. /usr/local/Cellar/boost/1.67.0_1/lib/ for the Library Search Paths (ss-3 ss-3)

like image 1
alp tuğan Avatar answered Nov 07 '22 18:11

alp tuğan