Błędy filesystem przy jakiejkolwiek funkcji filesystem.

0

Witam.

Nie mogę używać filesystem. Jakiejkolwiek funkcji bym nie użył, copy, remove itd.

Tutaj błąd:

D:\AppData\Tmp\ccqiv7bd.o:main.cpp:(.text+0x1d3): undefined reference to `std::e
xperimental::filesystem::v1::__cxx11::directory_iterator::operator*() const'
D:\AppData\Tmp\ccqiv7bd.o:main.cpp:(.text+0x20b): undefined reference to `std::e
xperimental::filesystem::v1::__cxx11::directory_iterator::operator++()'
D:\AppData\Tmp\ccqiv7bd.o:main.cpp:(.text$_ZNSt12experimental10filesystem2v17__c
xx1116filesystem_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES
t10error_code[__ZNSt12experimental10filesystem2v17__cxx1116filesystem_errorC1ERK
NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt10error_code]+0x2a): undef
ined reference to `vtable for std::experimental::filesystem::v1::__cxx11::filesy
stem_error'
D:\AppData\Tmp\ccqiv7bd.o:main.cpp:(.text$_ZNSt12experimental10filesystem2v17__c
xx1118directory_iteratorC1ERKNS2_4pathE[__ZNSt12experimental10filesystem2v17__cx
x1118directory_iteratorC1ERKNS2_4pathE]+0x22): undefined reference to `std::expe
rimental::filesystem::v1::__cxx11::directory_iterator::directory_iterator(std::e
xperimental::filesystem::v1::__cxx11::path const&, std::experimental::filesystem
::v1::directory_options, std::error_code*)'
D:\AppData\Tmp\ccqiv7bd.o:main.cpp:(.text$_ZNKSt12experimental10filesystem2v17__
cxx114path6stringIcSt11char_traitsIcESaIcEEENSt7__cxx1112basic_stringIT_T0_T1_EE
RKSC_[__ZNKSt12experimental10filesystem2v17__cxx114path6stringIcSt11char_traitsI
cESaIcEEENSt7__cxx1112basic_stringIT_T0_T1_EERKSC_]+0x198): undefined reference
to `std::experimental::filesystem::v1::__cxx11::filesystem_error::~filesystem_er
ror()'
D:\AppData\Tmp\ccqiv7bd.o:main.cpp:(.text$_ZNSt12experimental10filesystem2v17__c
xx114pathC1INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES3_EERKT_[__ZNSt
12experimental10filesystem2v17__cxx114pathC1INSt7__cxx1112basic_stringIcSt11char
_traitsIcESaIcEEES3_EERKT_]+0x51): undefined reference to `std::experimental::fi
lesystem::v1::__cxx11::path::_M_split_cmpts()'
D:\AppData\Tmp\ccqiv7bd.o:main.cpp:(.text$_ZNSt12experimental10filesystem2v17__c
xx114path4_CvtIcE11_S_wconvertEPKcS7_St17integral_constantIbLb1EE[__ZNSt12experi
mental10filesystem2v17__cxx114path4_CvtIcE11_S_wconvertEPKcS7_St17integral_const
antIbLb1EE]+0xce): undefined reference to `std::experimental::filesystem::v1::__
cxx11::filesystem_error::~filesystem_error()'

Jeśli użyję jakiejkolwiek funkcji to program przy kompilacji się sypie.
Tutaj kod:

#include <experimental/filesystem>
#include <iostream>

namespace fs = std::experimental::filesystem;

//Test 1

int main(){
    std::string path = "D:\\Private\\Cpp\\MainHeadersAndClasses\\ArgParser";
    for (auto &i : fs::directory_iterator(path))
        std::cout << i << std::endl;
}

Prosiłbym o pomoc.

Pozdrawiam.

1

Dodaj przy linkowaniu opcję łączenia z biblioteką libstdc++fs np. tak:

g++ -lstdc++fs -std=c++1z -o prog prog.cpp 
0

Dalej to samo.

1 użytkowników online, w tym zalogowanych: 0, gości: 1