How to fix C++ 'fatal error: stringstream: No such file or directory'

Problem:

Your C++ code contains a line like

#include <stringstream>

since you want to use std::stringstream, but your compiler gives you this error message:

main.cpp:2:10: fatal error: stringstream: No such file or directory
 #include <stringstream>
          ^~~~~~~~~~~~~~
compilation terminated.

Solution

The header is called sstream, not stringstream! Use this #include directive instead:

#include <sstream>