Programs using std::filesystem with gcc 9.2.0 fail to run

Csaba Raduly rcsaba@gmail.com
Sat Feb 8 13:46:00 GMT 2020


On Sat, Feb 8, 2020 at 2:22 AM <velix@bill.router5.com> wrote:

> It's possible to compile and link programs that use std::filesystem with
> the g++ 9.2.0 compiler for Cygwin.  For instance if I place the following
> program into a file name "x.cpp":
>
>     #include <iostream>
>     #include <filesystem>
>
>     int main()
>     {
>         std::filesystem::path p{"/tmp"};
>         std::cout << p << std::endl;
>     }
>
> Then compile with:
>
>     g++ -std=c++2a -Wall -O3 x.cpp
>
> It builds successfully.  But running the output "a.exe" file exits
> immediately with exit code 127.  It does not help if I also add
> "-lstdc++fs" to the build command.
>

Works just fine wih me:

$ g++ -std=c++2a -Wall -O3 fsys.cpp
$ ./a.exe
"/tmp"

Try running yours under gdb. You may get some more useful information about
the error.
Csaba
-- 
You can get very substantial performance improvements
by not doing the right thing. - Scott Meyers, An Effective C++11/14 Sampler
So if you're looking for a completely portable, 100% standards-conformant
way
to get the wrong information: this is what you want. - Scott Meyers
(C++TDaWYK)

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list