Include a header in another header file

前端 未结 5 1775
别跟我提以往
别跟我提以往 2020-12-31 08:43

I\'ve defined a struct item in a .h file. Now I\'m defining another struct tPCB in another .h which is part of the same project, and I need the

5条回答
  •  鱼传尺愫
    2020-12-31 08:56

    If your .c #includes the two .h files in the proper order, it will work. That's probably what happened in the case you remember. The safest course is to #include every file that defines your dependencies, and rely on the include guards in each .h to keep things from being multiply defined.

提交回复
热议问题