0
votes

I'm trying to test my boost installation with this code from here

#include<iostream>
#include<boost/filesystem/operations.hpp>

namespace bfs=boost::filesystem;

int main()
{
    bfs::path p("second.cpp");

    if(bfs::exists(p))

    std::cout<<p.leaf()<<std::endl;
}

On Ubuntu 16.04 the full error is

/usr/bin/ld: cannot find -lfile_system collect2: error: ld returned 1 exit status

I've looked in /usr/bin/ld the file does not exist and would like to know if I need to fix the boost installation or is their a linking problem that needs to be fixed.

1

1 Answers

0
votes

The name of the Boost filesystem library is boost_filesystem, so you need to link with:

-lboost_filesystem

(has always been in a system installation, can be more complex with a custom installation).

file_system was never the name of a Boost library.