implicit instantiation of undefined template error when trying to use stream

Viewed 14

FAILED: CMakeFiles/FileSystem.dir/main.cpp.o /Library/Developer/CommandLineTools/usr/bin/c++ -g -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk -std=gnu++20 -MD -MT CMakeFiles/FileSystem.dir/main.cpp.o -MF CMakeFiles/FileSystem.dir/main.cpp.o.d -o CMakeFiles/FileSystem.dir/main.cpp.o -c /Users/.../CLionProjects/FileSystem/main.cpp /Users/.../CLionProjects/FileSystem/main.cpp:9:5: error: implicit instantiation of undefined template 'std::basic_fstream' std::fstream ("test1.txt"); ^ /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/iosfwd:153:32: note: template is declared here class _LIBCPP_TEMPLATE_VIS basic_fstream; ^ 1 error generated. ninja: build stopped: subcommand failed.

#include<iostream>
#include<filesystem>

namespace fs = std::filesystem;

int main()
{
    fs::create_directories("test");
    std::fstream ("test1.txt");
     
}
0 Answers
Related