public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Programs using std::filesystem with gcc 9.2.0 fail to run
@ 2020-02-08  1:22 velix
  2020-02-08 13:46 ` Csaba Raduly
  0 siblings, 1 reply; 2+ messages in thread
From: velix @ 2020-02-08  1:22 UTC (permalink / raw)
  To: cygwin

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.

The output of "uname -a" is:
    CYGWIN_NT-6.1 price1 3.1.2(0.340/5/3) 2019-12-21 15:25 x86_64 Cygwin



--
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Programs using std::filesystem with gcc 9.2.0 fail to run
  2020-02-08  1:22 Programs using std::filesystem with gcc 9.2.0 fail to run velix
@ 2020-02-08 13:46 ` Csaba Raduly
  0 siblings, 0 replies; 2+ messages in thread
From: Csaba Raduly @ 2020-02-08 13:46 UTC (permalink / raw)
  To: cygwin list

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-08 13:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-08  1:22 Programs using std::filesystem with gcc 9.2.0 fail to run velix
2020-02-08 13:46 ` Csaba Raduly

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).