Score:0

Upgrade gcc version in Ubuntu 18,04

in flag

I'm running Ubuntu 18.04 in WSL, which I use to compile my c++ programs.

I need to write a program that gets the name of all the files in a certain directory and adds them into a vector of strings. Browsing the internet I found that I can use the "filesystem" library to do this in a simple and easy way.

The problem is that whenever I try using this answer I get the error 'filesystem' has not been declared. I suspect this happens because I may not have the filesystem library installed.

I already found a way to fix it by using experimental features and adding a flag to the compilation command, but I still wonder if there is some way to update my gcc package to one that has the library already installed.

My current gcc version is 7.5.0.

Is there a way I can do this?

Score:2
hr flag

filesystem is experimental in g++-7.5.0.

You should still be able to use it by including it as <experimental/filesystem> (which provides namespace std::experimental::filesystem), and linking libstdc++fs explicitly (with -lstdc++fs on the g++ command line), as described in Filesystem in C++17

Alternatively, you can install g++-9 (or even gcc-10) in bionic from the toolchain-r PPA.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.