问题描述
然而,我想在 C++ 中使用文件系统库,即使我以下列方式包含它,我也收到一条错误消息:“'filesystem' 不是命名空间类型”:
#ifndef __has_include
static_assert(false,"__has_include not supported");
#else
# if __has_include(<filesystem>)
# include <filesystem>
namespace fs = std::filesystem;
# elif __has_include(<experimental/filesystem>)
# include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
# elif __has_include(<boost/filesystem.hpp>)
# include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
# endif
#endif
所以它找到了文件系统头,但是它不能识别它。
包含
运行
$gcc --verison
给出以下输出:
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation,Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
'''
这是我使用 VERBOSE=1 运行 make 时的示例输出:
/usr/bin/c++ -DBOOST_ALL_NO_LIB -DBOOST_ATOMIC_DYN_LINK -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_REGEX_DYN_LINK -DBOOST_SYSTEM_DYN_LINK -DBOOST_THREAD_DYN_LINK -DGR_CTRLPORT -Dgnuradio_lkn_ncs_EXPORTS -I/home/name/folder/project/projectname/lib/../include -O3 -DNDEBUG -fPIC -fvisibility=hidden -std=gnu++11 -o CMakeFiles/gnuradio-lkn_ncs.dir/mac_controller_impl.cc.o -c /home/name/folder/project/projectname/lib/mac_controller_impl.cc
感谢任何帮助!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)