我正在Ubuntu 18的Qt 5.12.2中使用std :: filesystem来测试gcc 9.1,以打印current_path()
...它已成功编译,但在运行时向我显示了控制台中的此错误:>
/home/hnf/build-testing_Filesystem-Desktop_Qt_5_12_2_GCC_64bit-Debug/testing_Filesystem: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /home/hnf/build-testing_Filesystem-Desktop_Qt_5_12_2_GCC_64bit-Debug/testing_Filesystem)
注意,我使用-std = c ++ 17进行编译,并且尝试与-lstdc ++ fs链接 只是为了查看问题是否与此有关,但是在运行时会出现相同的问题。
我也尝试使用代码块17,但没有任何变化。
我做错了什么?
谢谢。
EDIT1
这是测试代码:
#include <iostream>
#include <filesystem>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
std::cout << "Dossier actuel:\n\n" << std::filesystem::current_path();
return a.exec();
}
EDIT2
由于要标记为重复项,因此我将gcc安装在另一个文件夹中并使其成为主要文件夹...非常感谢...