'fatal error: sstream: No such file or directory

I have included graphics.h header in my source file and i am trying to run an old C code in Code Blocks. I am using gcc version 4.8.1.I got the following error

fatal error: sstream: No such file or directory


Solution 1:[1]

graphics.h is including a c++ header sstream, you can't use it when compiling with a c compiler, switch your code to c++, that can be done by simply changing the file extension to .cpp for example or .cc and gcc will automatically use g++ when compiling the file.

Solution 2:[2]

There is no stringstream's in C.In C++ they are.

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 Iharob Al Asimi
Solution 2 stryku