interwebjill
interwebjill

Reputation: 950

boost/filesystem.hpp not linking in osx boost installed via homebrew

I installed boost via

$ brew install boost

In xcode I have specified

/usr/local/Cellar/boost/1.65.1/include

in my header search path and

/usr/local/Cellar/boost/1.65.1/lib 

in my library search path. I can successfully

#include <boost/variant.hpp>

but when I try to include boost/filesystem.hpp I get the linker error:

Undefined symbols for architecture x86_64:
"boost::system::system_category()"

The directory /usr/local/Cellar/boost/1.65.1/include/boost does include filesystem.hpp.

I tried the solution here but it did not help with including boost/filesystem.hpp. What could be the issue?

Are there flags I should have used to install Boost?

Upvotes: 0

Views: 1634

Answers (1)

Maxim Egorushkin
Maxim Egorushkin

Reputation: 136296

boost::system::system_category() is defined in libboost_system.{so,a}, so you need to

  1. add library path /usr/local/Cellar/boost/1.65.1/lib (or whatever that is), and
  2. link that library with -lboost_system linker option.

Auto-linking works on Windows only.

Upvotes: 2

Related Questions