[llvm-dev] Problem using Boost Filesystem with Clang

Simone Atzeni via llvm-dev llvm-dev at lists.llvm.org
Wed Feb 15 10:01:14 PST 2017


Hi,

not sure if this is the right place, but I am experiencing a problem using clang++ (3.9.1) with Boost Filesystem.

I have this simple program:

------------------------------------------------------------------------
#include <iostream>
#include <boost/filesystem.hpp>
using namespace boost::filesystem;

int main(int argc, char* argv[])
{
  if (argc < 2)
    {
      std::cout << "Usage: tut1 path\n";
      return 1;
    }
  std::cout << argv[1] << " " << file_size(argv[1]) << '\n';
  return 0;
}
------------------------------------------------------------------------

If I compile with g++ using "g++ -lboost_system -lboost_filesystem main.cpp” and run it I obtain the size of a file that I use as input.

If I compile with clang++ using " clang++ -std=c++11 -stdlib=libc++ -lboost_system -lboost_filesystem main.cpp” when I run the program I get the error:

"boost::filesystem::file_size: Bad address”

Any idea why?

Thanks.
Simone



More information about the llvm-dev mailing list