Why does omission of “#include ” only sometimes cause compilation failures?

后端 未结 7 2228
清歌不尽
清歌不尽 2020-11-22 14:23

I am a beginner with C++. When I write the code sometimes I write #include and the code works, other times I don\'t write #include

7条回答
  •  北海茫月
    2020-11-22 14:54

    It is not true that the header string is included by other headers. The header string itself only has includes. No Definitions. So all necessary definitions needed for the usage of string are in headers included by the header string. These headers may already be included by other headers. Then everything works. The header ios for example includes stringbuf, which includes ...

提交回复
热议问题