0

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?

Mateoglzc
  • 11
  • 3
  • check this [link](https://stackoverflow.com/a/45867491/13785481) – Vamsee. Sep 22 '21 at 04:04
  • @Vamsee Right, in the post you link, it says I can use "experimental/filesystem", and although I can use this with no problems. Is there a way I can upgrade my current gcc version to gcc 8.1 so I don't have to use the experimental version? – Mateoglzc Sep 22 '21 at 04:32
  • See https://askubuntu.com/questions/466651/how-do-i-use-the-latest-gcc-on-ubuntu – Alan Birtles Sep 22 '21 at 06:51
  • I’m voting to close this question because it'd be better on ask Ubuntu – Alan Birtles Sep 22 '21 at 06:51
  • Install `gcc-8`. It is version 8.4. – molbdnilo Sep 22 '21 at 07:44
  • @AlanBirtles While it may be a *better* fit for Ask Ubuntu (or Unix & Linux Stack), it seems to me that this question is quite on-topic here as it deals with *"software tools commonly used by programmers; and is a practical, answerable problem that is unique to software development"* (per the [on-topic guidelines](https://stackoverflow.com/help/on-topic). That said, the question could probably be improved with a [MRE](https://stackoverflow.com/help/minimal-reproducible-example). – NotTheDr01ds Sep 22 '21 at 20:54

0 Answers0