$ cat main.x.cpp #include <iostream> #include <experimental/filesystem> namespace fs = std::experimental::filesystem; int main() { std::cout << "Current path is "<< fs::current_path() << '\n'; } $ icpc main.x.cpp -lstdc++fs -std=c++14 # Works! $ icpc main.x.cpp -lstdc++fs -std=c++14 -g # Doesn't work /spare/scratch/icpcNgdXiG.o: In function `std::basic_string<char, std::char_traits<char>, std::allocator<char> > std::experimental::filesystem::v1::path::string<char, std::char_traits<char>, std::allocator<char> >(std::allocator<char> const&) const': /spare/scratch/tmp-e31ZpjU-infra/gcc/5.4.0/include/c++/5.4.0/experimental/fs_path.h:822: undefined reference to `std::codecvt_utf8<char, 1114111ul, (std::codecvt_mode)0>::codecvt_utf8(unsigned long)' /spare/scratch/tmp-e31ZpjU-infra/gcc/5.4.0/include/c++/5.4.0/experimental/fs_path.h:822: undefined reference to `std::codecvt_utf8<char, 1114111ul, (std::codecvt_mode)0>::~codecvt_utf8()' /spare/scratch/tmp-e31ZpjU-infra/gcc/5.4.0/include/c++/5.4.0/experimental/fs_path.h:825: undefined reference to `std::codecvt_utf8<char, 1114111ul, (std::codecvt_mode)0>::~codecvt_utf8()' $ icpc main.x.cpp -lstdc++fs -std=c++14 -g -mGLOB_opt_level=1 # Works!
This has been tested with Intel compilers 16 to 19 and the behavior is same.