how to include 2 files with same name?

前端 未结 2 680
谎友^
谎友^ 2021-01-20 18:59

I am working in ubuntu, I have a folder that contains a subfolder. in the first folder i have a name.h file. in subfolder i have again a name.h file. the thing is that i nee

相关标签:
2条回答
  • 2021-01-20 19:08

    If they have the same header guard, then there'll be problem, otherwise it should work.

    0 讨论(0)
  • 2021-01-20 19:29

    So, something like this :

    <some dir>
      -> <sub1>
           header.hpp
      -> <sub2>
           header.hpp
    

    This is resolved by telling the compiler to search in the common folder for the headers (in the above case ) and including like this :

    #include "sub1/header.hpp"
    #include "sub2/header.hpp"
    
    0 讨论(0)
提交回复
热议问题