Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to include 2 files with same name?

Tags:

c++

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 need both the headers. the problem is the fact that both headers have the same name. i receive errors saying that a specific function was not declared in this scope. how to resolve this error? isn't there a way to specifiy to a specific method, variable what header to use ? is there a way to resolve this problem?

like image 606
marryy Avatar asked Feb 13 '26 10:02

marryy


1 Answers

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"
like image 196
BЈовић Avatar answered Feb 15 '26 23:02

BЈовић