# Fatal error: file not found

**URL:** https://discourse.cmake.org/t/fatal-error-file-not-found/8499
**Category:** Usage
**Created:** [July 12, 2023, 5:38am UTC](https://discourse.cmake.org/t/fatal-error-file-not-found/8499 "2023-07-12T05:38:01Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Xuzrxa](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/x/67e7ee/32.png) [@Xuzrxa](https://discourse.cmake.org/u/Xuzrxa)
#### Post date: [July 12, 2023, 5:38am UTC](https://discourse.cmake.org/t/fatal-error-file-not-found/8499/1 "2023-07-12T05:38:01Z")

</div>

what could be wrong with linking here?  
basically why is `fileB.cpp` not able to include `fileA.hpp` despite linking `dir-B` with `dir-A`?

```cmake
> dirA
  > include
    > fileA.hpp
  > src
    > fileA.cpp

add_library(dir-A STATIC src/fileA.cpp)
target_include_directories(dir-A PUBLIC include)
target_link_libraries(dir-A #<some-external-libs>)

```

```cmake
set(THIS dir-B)
target_link_libraries(${THIS} PUBLIC dir-A) # Link dir-A as a dependency of dir-B

```

```cmake
set(THIS dir-C)
add_executable(${THIS} fileB.cpp fileC.cpp)
target_link_libraries(${THIS} PRIVATE dir-B) # Link dir-B as a dependency of dir-C

```

````cpp
// fileC.cpp
#include "fileB.hpp"    

// fileB.hpp
#include "fileA.hpp" // fatal error: fileA.hpp: No such file or directory```
````

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [July 17, 2023, 11:41am UTC](https://discourse.cmake.org/t/fatal-error-file-not-found/8499/2 "2023-07-17T11:41:48Z")

</div>

> [@Xuzrxa](#):
>
> `target_include_directories(dir-A PUBLIC include)`

Does it work with `${CMAKE_CURRENT_SOURCE_DIR}/include` here?
