How to fix GCC error: implicit instantiation of undefined template 'std::basic_stringstream<char>'

Problem:

When trying to compile your C++ application, you see an error message such as

main.cpp:15:23: error: implicit instantiation of undefined template 'std::basic_stringstream<char>'
    std::stringstream ss;
                      ^

Solution

At the top of the file where this error occurs, add the following line:

#include <sstream>