Reputation: 9540
Given the following directory structure:
Notice how there are two files named System-Libraries.hpp
The way I include either currently is:
#include "System-Libraries.hpp"
So clearly there is an ambiguity here. This project compiles and runs, so the system seems to be currently finding the correct header, but I don't expect this to be because of defined behaviour I think I am just getting lucky.
How do CMake, Make and g++ determine which of the 2 files will be used for compilation for a given cpp?
Note I am not asking how to fix it, fixing it involves either changing the header names so that they are different or including the relative path on inclusion, this is not what I am worried about. I want to know why neither CMake nor g++ complain about the two files being named the same and being included in the same final executable.
Upvotes: 2
Views: 5232