我在Ubuntu 16.04上使用gcc 7.2,我需要使用C++ 17中的新文件系统库.即使确实有一个名为experimental/filesystem的库,我也不能使用它的任何成员.例如,当我尝试编译此文件时:
#include <iostream>
#include <string>
#include <experimental/filesystem>
using namespace std;
namespace fs = std::experimental::filesystem::v1;
int main(){
fs::path p1 = "/usr/share/";
}
Run Code Online (Sandbox Code Playgroud)
我收到一个编译错误,如下所示:
$ g++-7 test.cpp -std=c++17
/tmp/ccfsMnlG.o: In function `std::experimental::filesystem::v1::__cxx11::path::path<char [12], std::experimental::filesystem::v1::__cxx11::path>(char const (&) [12])':
test.cpp:(.text._ZNSt12experimental10filesystem2v17__cxx114pathC2IA12_cS3_EERKT_[_ZNSt12experimental10filesystem2v17__cxx114pathC5IA12_cS3_EERKT_]+0x73): undefined reference to `st
d::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
collect2: error: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?我不认为代码有任何问题,因为我只是从网站上复制粘贴它.我使用的是错误的gcc版本吗?另外,为什么我需要<experimental/filesystem>
而不仅仅是<filesystem>
在C++ 17中呢?提前致谢.
在我的应用程序中,我希望有大段文本,其时间戳中心与每个文本对象的第一行对齐。有没有办法做到这一点?
这是我正在尝试做的一个例子。
我尝试将第一行隔离到一个单独的对象中,但我不知道如何做。在 CSS 中,我可以使用伪元素来完成此任务。
我当前的两个元素的代码看起来像
<View>
<Text style={styles.timestamp}>6:42 AM</Text>
<Text style={styles.paragraph}>
A long paragraph of text for demonstration.
</Text>
</View>
Run Code Online (Sandbox Code Playgroud)