Cześć,
mam taki problem: pracuję na Qt Creatorze i dzisiaj utworzyłem projekt chcąc używać C++17.
Niestety, kiedy chciałem sprawdzić użycie filesystem na poniższym kodzie:
#include <iostream>
#include <variant>
#include <any>
#include <experimental/filesystem>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
std::experimental::filesystem::path _path = "C:\Projects";
cout << "Path: " << _path << endl;
return 0;
}
Dostałem poniższy błąd:
C:\Qt\Tools\mingw730_64\lib\gcc\x86_64-w64-mingw32\7.3.0\include\c++\experimental\bits\fs_path.h:198: błąd: undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
C:\Projekty\C++\Test\Test2\Test2\main.cpp:-1: błąd: undefined reference to `std::experimental::filesystem::v1::__cxx11::filesystem_error::~filesystem_error()'
C:\Projekty\C++\Test\Test2\Test2\main.cpp:-1: błąd: undefined reference to `vtable for std::experimental::filesystem::v1::__cxx11::filesystem_error'
collect2.exe:-1: błąd: error: ld returned 1 exit status
W googlach piszą, że powinno się użyć poniższego wpisu w pliku konfiguracyjnym, ale mi nic nie pomaga:
QMAKE_LFLAGS += -lstdc++fs
Poniżej wklejam mój plik konfiguracyjny.
TEMPLATE = app
CONFIG += console c++17
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += \
main.cpp
**Czy ktoś spotkał się z poniższym problemem?
Proszę o pomoc, bo już dużo czasu nad tym straciłem.
**