where should “include” be put in C++

后端 未结 9 1998
生来不讨喜
生来不讨喜 2020-12-14 16:06

I\'m reading some c++ code and Notice that there are "#include" both in the header files and .cpp files . I guess if I move all the "#include" in the fi

9条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-14 16:16

    Including header files from within header files is fine, so is including in c++ files, however, to minimize build times it is generally preferable to avoid including a header file from within another header unless absolutely necessary especially if many c++ files include the same header.

提交回复
热议问题