• <bdo id='ypojq'></bdo><ul id='ypojq'></ul>

        <small id='ypojq'></small><noframes id='ypojq'>

      1. <legend id='ypojq'><style id='ypojq'><dir id='ypojq'><q id='ypojq'></q></dir></style></legend>
        <tfoot id='ypojq'></tfoot>
        <i id='ypojq'><tr id='ypojq'><dt id='ypojq'><q id='ypojq'><span id='ypojq'><b id='ypojq'><form id='ypojq'><ins id='ypojq'></ins><ul id='ypojq'></ul><sub id='ypojq'></sub></form><legend id='ypojq'></legend><bdo id='ypojq'><pre id='ypojq'><center id='ypojq'></center></pre></bdo></b><th id='ypojq'></th></span></q></dt></tr></i><div id='ypojq'><tfoot id='ypojq'></tfoot><dl id='ypojq'><fieldset id='ypojq'></fieldset></dl></div>

        'std::filesystem' 在包含 &lt;experimental/filesyste

        #39;std::filesystem#39; has not been declared after including lt;experimental/filesystemgt;(std::filesystem 在包含 lt;experimental/filesystemgt; 后没有被声明)

        <legend id='HJ1i4'><style id='HJ1i4'><dir id='HJ1i4'><q id='HJ1i4'></q></dir></style></legend>
          • <tfoot id='HJ1i4'></tfoot>
          • <i id='HJ1i4'><tr id='HJ1i4'><dt id='HJ1i4'><q id='HJ1i4'><span id='HJ1i4'><b id='HJ1i4'><form id='HJ1i4'><ins id='HJ1i4'></ins><ul id='HJ1i4'></ul><sub id='HJ1i4'></sub></form><legend id='HJ1i4'></legend><bdo id='HJ1i4'><pre id='HJ1i4'><center id='HJ1i4'></center></pre></bdo></b><th id='HJ1i4'></th></span></q></dt></tr></i><div id='HJ1i4'><tfoot id='HJ1i4'></tfoot><dl id='HJ1i4'><fieldset id='HJ1i4'></fieldset></dl></div>

                <tbody id='HJ1i4'></tbody>

              <small id='HJ1i4'></small><noframes id='HJ1i4'>

                  <bdo id='HJ1i4'></bdo><ul id='HJ1i4'></ul>
                • 本文介绍了'std::filesystem' 在包含 &lt;experimental/filesystem&gt; 后没有被声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我查了很多关于c++17下文件系统链接的问题,还是不能成功链接.我的 main.cpp 文件如下.

                  I have checked a lot of issues about the link of filesystem under c++17 and I still cannot make the link successfully. My main.cpp file is as the following.

                  #include <experimental/filesystem>
                  
                  
                  int main(int argc, char** argv)
                  {
                      std::string imageDirectory = "./image";;
                      std::vector<std::string> imagePath;
                  
                      for (const auto& entry: std::filesystem::directory_iterator(imageDirectory))
                      {
                          imagePath.push_back(entry.path());
                          std::cout << entry.path() << std::endl;
                      }
                  
                      return 0;
                  }
                  

                  我的 CMakeLists.txt 如下.

                  cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
                  
                  project(visual_hull LANGUAGES CXX)
                  set(CMAKE_CXX_STANDARD 17)
                  add_library(dataIO
                          STATIC
                              dataIO.hpp
                              dataIO.cpp)
                  
                  find_package(OpenCV REQUIRED core highgui imgproc)
                  
                  target_link_libraries(dataIO ${OpenCV_LIBS})
                  
                  add_executable(visual_hull main.cpp)
                  
                  target_link_libraries(visual_hull PUBLIC dataIO
                                                           stdc++fs)
                  

                  错误如下.

                  /home/SENSETIME/zhangshunkang/Downloads/programming/c++/visual_hull/main.cpp: In function ‘int main(int, char**)’:
                  /home/SENSETIME/zhangshunkang/Downloads/programming/c++/visual_hull/main.cpp:15:31: error: ‘std::filesystem’ has not been declared
                    for (const auto& entry: std::filesystem::directory_iterator(imageDirectory))
                                                 ^
                  CMakeFiles/visual_hull.dir/build.make:62: recipe for target 'CMakeFiles/visual_hull.dir/main.cpp.o' failed
                  make[2]: *** [CMakeFiles/visual_hull.dir/main.cpp.o] Error 1
                  CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/visual_hull.dir/all' failed
                  make[1]: *** [CMakeFiles/visual_hull.dir/all] Error 2
                  Makefile:83: recipe for target 'all' failed
                  make: *** [all] Error 2
                  

                  推荐答案

                  您使用 std::filesystem::directory_iterator.std::filesystem::directory_iterator 和整个命名空间 std::filesystem 在头文件 中声明.

                  You use std::filesystem::directory_iterator. std::filesystem::directory_iterator and the entire namespace std::filesystem are declared in the header <filesystem>.

                  您尚未包含标题 .相反,您包含了 .这个头文件没有声明 std::filesystem::directory_iterator.相反,它声明了 std::experimental::filesystem::directory_iterator.

                  You haven't included the header <filesystem>. Instead, you've included <experimental/filesystem>. This header does not declare std::filesystem::directory_iterator. Instead, it declares std::experimental::filesystem::directory_iterator.

                  您可以始终使用标准文件系统库或技术规范中的实验文件系统库,但不得将它们混合在一起.如果您的目标是 C++17,那么您应该使用 .

                  You can consistently use either the standard filesystem library, or the experimental filesystem library from the technical specification, but you must not mix them together. If you're targeting C++17, then you should use <filesystem>.

                  我会得到文件系统的错误:没有这样的文件或目录

                  I will get the error that filesystem: No such file or directory

                  理想的解决方案是将编译器升级到对 C++17 提供非实验性支持的版本.否则使用实验性 TS 或 Boost.

                  The ideal solution is to upgrade your compiler to a version that has non-experimental support for C++17. Otherwise use the experimental TS or Boost.

                  这篇关于'std::filesystem' 在包含 &lt;experimental/filesystem&gt; 后没有被声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What is inside .lib file of Static library, Statically linked dynamic library and dynamically linked dynamic library?(静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么?)
                  How do I load a C DLL from the SXS in Python?(如何从 Python 中的 SXS 加载 C DLL?)
                  Can Cython code be compiled to a dll so C++ application can call it?(Cython 代码可以编译成 dll 以便 C++ 应用程序可以调用它吗?)
                  Delay Loading DLLs(延迟加载 DLL)
                  Throwing C++ exceptions across DLL boundaries(跨 DLL 边界抛出 C++ 异常)
                  Loading a dll from a dll?(从 dll 加载 dll?)
                      <tbody id='sJwvs'></tbody>

                    <tfoot id='sJwvs'></tfoot>

                    1. <small id='sJwvs'></small><noframes id='sJwvs'>

                      <legend id='sJwvs'><style id='sJwvs'><dir id='sJwvs'><q id='sJwvs'></q></dir></style></legend>
                      <i id='sJwvs'><tr id='sJwvs'><dt id='sJwvs'><q id='sJwvs'><span id='sJwvs'><b id='sJwvs'><form id='sJwvs'><ins id='sJwvs'></ins><ul id='sJwvs'></ul><sub id='sJwvs'></sub></form><legend id='sJwvs'></legend><bdo id='sJwvs'><pre id='sJwvs'><center id='sJwvs'></center></pre></bdo></b><th id='sJwvs'></th></span></q></dt></tr></i><div id='sJwvs'><tfoot id='sJwvs'></tfoot><dl id='sJwvs'><fieldset id='sJwvs'></fieldset></dl></div>

                          • <bdo id='sJwvs'></bdo><ul id='sJwvs'></ul>