Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS: Build Error: no member named 'filesystem' in namespace 'boost' #54

Open
farhanhubble opened this issue Feb 20, 2024 · 3 comments

Comments

@farhanhubble
Copy link

I'm following the steps given for MacOS and ran into a compilation error on the make step.

[ 25%] Building CXX object CMakeFiles/environment.dir/src/environment.cpp.o
In file included from /Users/farhan/devel/udacity/SFND_Lidar_Obstacle_Detection/src/environment.cpp:7:
/Users/farhan/devel/udacity/SFND_Lidar_Obstacle_Detection/src/processPointClouds.h:47:17: error: no member named 'filesystem' in namespace 'boost'; did you mean 'std::__fs::filesystem'?
    std::vector<boost::filesystem::path> streamPcd(std::string dataPath);
                ^~~~~~~~~~~~~~~~~
                std::__fs::filesystem
/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__filesystem/u8path.h:32:1: note: 'std::__fs::filesystem' declared here
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__config:724:62: note: expanded from macro '_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM'
      _LIBCPP_BEGIN_NAMESPACE_STD namespace __fs { namespace filesystem {
                                                             ^
In file included from /Users/farhan/devel/udacity/SFND_Lidar_Obstacle_Detection/src/environment.cpp:9:
/Users/farhan/devel/udacity/SFND_Lidar_Obstacle_Detection/src/processPointClouds.cpp:132:13: error: no member named 'filesystem' in namespace 'boost'; did you mean 'std::__fs::filesystem'?
std::vector<boost::filesystem::path> ProcessPointClouds<PointT>::streamPcd(std::string dataPath)
            ^~~~~~~~~~~~~~~~~
            std::__fs::filesystem
/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__filesystem/u8path.h:32:1: note: 'std::__fs::filesystem' declared here
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__config:724:62: note: expanded from macro '_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM'
      _LIBCPP_BEGIN_NAMESPACE_STD namespace __fs { namespace filesystem {
                                                             ^
In file included from /Users/farhan/devel/udacity/SFND_Lidar_Obstacle_Detection/src/environment.cpp:9:
/Users/farhan/devel/udacity/SFND_Lidar_Obstacle_Detection/src/processPointClouds.cpp:135:17: error: no member named 'filesystem' in namespace 'boost'; did you mean 'std::__fs::filesystem'?
    std::vector<boost::filesystem::path> paths(boost::filesystem::directory_iterator{dataPath}, boost::filesystem::directory_iterator{});
                ^~~~~~~~~~~~~~~~~
                std::__fs::filesystem
/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__filesystem/u8path.h:32:1: note: 'std::__fs::filesystem' declared here
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__config:724:62: note: expanded from macro '_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM'
      _LIBCPP_BEGIN_NAMESPACE_STD namespace __fs { namespace filesystem {
                                                             ^
In file included from /Users/farhan/devel/udacity/SFND_Lidar_Obstacle_Detection/src/environment.cpp:9:
/Users/farhan/devel/udacity/SFND_Lidar_Obstacle_Detection/src/processPointClouds.cpp:135:48: error: no member named 'filesystem' in namespace 'boost'; did you mean 'std::__fs::filesystem'?
    std::vector<boost::filesystem::path> paths(boost::filesystem::directory_iterator{dataPath}, boost::filesystem::directory_iterator{});
                                               ^~~~~~~~~~~~~~~~~
                                               std::__fs::filesystem
/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__filesystem/u8path.h:32:1: note: 'std::__fs::filesystem' declared here
@farhanhubble
Copy link
Author

System information

MacOS Sonoma on Intel Silicon 
boost: stable 1.84.0 (bottled), HEAD
Collection of portable C++ source libraries
https://www.boost.org/
/usr/local/Cellar/boost/1.84.0 (16,054 files, 500.8MB) *
  Poured from bottle using the formulae.brew.sh API on 2024-02-20 at 22:42:08
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/b/boost.rb
License: BSL-1.0
==> Dependencies
Required: icu4c ✔, xz ✔, zstd ✔
gcc: stable 13.2.0 (bottled), HEAD
GNU compiler collection
https://gcc.gnu.org/
/usr/local/Cellar/gcc/13.2.0 (1,590 files, 401.9MB) *
  Poured from bottle using the formulae.brew.sh API on 2024-02-20 at 22:42:25
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/g/gcc.rb
License: GPL-3.0-or-later with GCC-exception-3.1
==> Dependencies
Required: gmp ✔, isl ✔, libmpc ✔, mpfr ✔, zstd ✔
pcl: stable 1.14.0 (bottled), HEAD
Library for 2D/3D image and point cloud processing
https://pointclouds.org/
/usr/local/Cellar/pcl/1.14.0_1 (1,254 files, 146.7MB) *
  Poured from bottle using the formulae.brew.sh API on 2024-02-20 at 22:45:47
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/p/pcl.rb
License: BSD-3-Clause
==> Dependencies
Build: cmake ✔, pkg-config ✘
Required: boost ✔, cminpack ✔, eigen ✔, flann ✔, glew ✔, libpcap ✔, libusb ✔, qhull ✔, qt ✔, vtk ✔, libomp ✔

@farhanhubble
Copy link
Author

Triage: The file SFND_Lidar_Obstacle_Detection/src/processPointClouds.h does not include boost/filesystem headers nor is there anything in the CmakeList.txt file. The could have been "accidentally working" due to another package, likely QT, importing boost headers in its previous versions.

@farhanhubble
Copy link
Author

Adding an explicit #include <boost/filesystem.hpp> to processPointClouds.h solves the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant