What order do I include header files in?

前端 未结 5 1422
挽巷
挽巷 2021-02-15 11:26

I\'m new to programming and the topic of header files is sort of bogging me down after I started using a lot of them. In addition to that I\'m trying to use precompiled headers.

5条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-15 12:00

    Take a look at a similar question to learn a good approach to authoring headers.

    In short, you want to define each header inside a definition guard that prevents headers from being included more then once during compilation. With those in place, for each .h and .cpp file, just include the headers needed to resolve any declarations. The pre-processor and compiler will take care of the rest.

提交回复
热议问题