Reputation: 1711
I'm trying to create a directory in C++ (compiling with Clang) on Mac Yosemite with Boost (Boost was installed via Macports). This is what my code looks like:
#include <boost/filesystem.hpp> // header at top of file
boost::filesystem::path path("/Users/u5305887/Desktop/ti"); // code in main function
boost::filesystem::create_directories( path );
However, when I compile it, I get the following error:
Undefined symbols for architecture x86_64: "boost::filesystem::detail::create_directories(boost::filesystem::path const&, boost::system::error_code*)"
I've been trying to Google this error but I can't seem to find any way to fix it. I've double checked my code against a few tutorials and can't see where I've gone wrong.
Upvotes: 0
Views: 881
Reputation: 343
You need to link against the boost libraries. E.g. for clang you'd add
-lboost_system -lboost_filesystem
to your linking step.
Upvotes: 6