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

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

      <legend id='G92he'><style id='G92he'><dir id='G92he'><q id='G92he'></q></dir></style></legend>

        实验::文件系统链接器错误

        时间:2023-09-19
        <legend id='YW8HX'><style id='YW8HX'><dir id='YW8HX'><q id='YW8HX'></q></dir></style></legend>

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

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

            <bdo id='YW8HX'></bdo><ul id='YW8HX'></ul>

                • <tfoot id='YW8HX'></tfoot>

                    <tbody id='YW8HX'></tbody>
                  本文介绍了实验::文件系统链接器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我尝试在 gcc 6.0 中实际使用新的 c++1z 特性.

                  如果我试试这个小例子:

                  #include #include <实验/文件系统>命名空间 fs = std::experimental::filesystem;int main(){fs::path p1 = "/home/pete/checkit";std::cout <<"p1 = " <<p1<<std::endl;}

                  我得到了:

                  <前>/opt/linux-gnu_6-20151011/bin/g++ --std=c++1z main.cpp -O2 -g -o go/tmp/ccaGzqFO.o:在函数`std::experimental::filesystem::v1::__cxx11::path::path(char const (&) [36])'中:/opt/linux-gnu_6-20151011/include/c++/6.0.0/experimental/bits/fs_path.h:167:对`std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts的未定义引用()'collect2:错误:ld 返回 1 个退出状态

                  gcc 版本是快照 linux-gnu_6-20151011

                  任何提示如何链接新的 c++1z 功能?

                  解决方案

                  文件系统 TS 与 C++1z 支持无关,它是一个完全独立的规范,不属于 C++1z 工作草案的一部分.GCC 的实现(在 GCC 5.3 及更高版本中)甚至可以在 C++11 模式下使用.

                  您只需要与 -lstdc++fs 链接即可使用.

                  (相关库,libstdc++fs.a,是一个静态库,因此对于任何静态库,它应该依赖于它的任何对象之后在链接器命令中.)

                  2017 年 11 月更新:除了文件系统 TS,GCC 8.x 实现了 C++17 文件系统库,定义在 在使用 -std=gnu++17-std=c++17.GCC 的 C++17 支持尚不完整或稳定,在它被认为可以用于黄金时间之前,您还需要链接到 -lstdc++fs 以获取 C++17 文件系统功能.

                  2019 年 1 月更新:从 GCC 9 开始,C++17 std::filesystem 组件可以在没有 -lstdc++fs 的情况下使用code>(但您仍然需要 std::experimental::filesystem 的库).

                  I try to use the new c++1z features actually on the head of development within gcc 6.0.

                  If I try this little example:

                  #include <iostream>
                  #include <experimental/filesystem>
                  namespace fs = std::experimental::filesystem;
                  int main()
                  {
                      fs::path p1 = "/home/pete/checkit";
                  
                      std::cout << "p1 = " << p1 << std::endl;
                  }
                  

                  I got:

                  /opt/linux-gnu_6-20151011/bin/g++ --std=c++1z main.cpp -O2 -g -o go
                  /tmp/ccaGzqFO.o: In function `std::experimental::filesystem::v1::__cxx11::path::path(char const (&) [36])':
                  /opt/linux-gnu_6-20151011/include/c++/6.0.0/experimental/bits/fs_path.h:167: undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
                  collect2: error: ld returned 1 exit status
                  

                  gcc version is the snapshot linux-gnu_6-20151011

                  Any hints how to link for the new c++1z features?

                  解决方案

                  The Filesystem TS is nothing to do with C++1z support, it is a completely separate specification not part of the C++1z working draft. GCC's implementation (in GCC 5.3 and later) is even available in C++11 mode.

                  You just need to link with -lstdc++fs to use it.

                  (The relevant library, libstdc++fs.a, is a static library, so as with any static library it should come after any objects that depend on it in the linker command.)

                  Update Nov 2017: as well as the Filesystem TS, GCC 8.x also has an implementation of the C++17 Filesystem library, defined in <filesystem> and in namespace std::filesystem (N.B. no "experimental" in those names) when using -std=gnu++17 or -std=c++17. GCC's C++17 support is not complete or stable yet, and until it's considered ready for prime time use you also need to link to -lstdc++fs for the C++17 Filesystem features.

                  Update Jan 2019: starting with GCC 9, the C++17 std::filesystem components can be used without -lstdc++fs (but you still need that library for std::experimental::filesystem).

                  这篇关于实验::文件系统链接器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  <tfoot id='8853c'></tfoot>

                  <small id='8853c'></small><noframes id='8853c'>

                  • <bdo id='8853c'></bdo><ul id='8853c'></ul>

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