'C++ filesystem lib not importing

I'm working on a small project with CMake and I'm trying to use the filesystem library to generate asset directories but when trying to use namespace fs = std::filesystem visual studio marks it with a red underline and it doesn't build correctly. I can't find any reason why this shouldn't work. The code I'm using is:

#include <filesystem>
namespace fs = std::filesystem;


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source