最佳答案
我尝试在 gcc 6.0的开发中使用新的 c + + 1z 特性。
如果我试试这个小例子:
#include <iostream>
#include <experimental/filesystem>
namespace 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: 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 版本是快照 linux-gnu _ 6-20151011
Any hints how to link for the new c++1z features?