C语言 致命错误:sstream:没有那个文件或目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29040857/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 11:47:42  来源:igfitidea点击:

fatal error: sstream: No such file or directory

cmingwcodeblocks

提问by Shantanu

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

我在我的源文件中包含了 graphics.h 头文件,我正在尝试在代码块中运行旧的 C 代码。我正在使用 gcc 版本 4.8.1。我收到以下错误

fatal error: sstream: No such file or directory

回答by Iharob Al Asimi

graphics.his 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 .cppfor example or .ccand gccwill automatically use g++when compiling the file.

graphics.h包含一个 c++ 头文件sstream,在用 ac 编译器编译时不能使用它,将代码切换到 c++,这可以通过简单地将文件扩展名更改.cpp为例如 or来完成,.cc并且在编译文件时gcc将自动使用g++

回答by stryku

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

stringstreamC 中没有's。在 C++ 中它们是。