# Linking itk with an external project

**URL:** https://discourse.itk.org/t/linking-itk-with-an-external-project/5481
**Category:** Beginner Questions
**Tags:** cmake
**Created:** [November 10, 2022, 5:07pm UTC](https://discourse.itk.org/t/linking-itk-with-an-external-project/5481 "2022-11-10T17:07:37Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Ajay\_Emmanuel](https://discourse.itk.org/user_avatar/discourse.itk.org/ajay_emmanuel/32/3038_2.png) [@Ajay\_Emmanuel](https://discourse.itk.org/u/Ajay_Emmanuel)
#### Post date: [November 10, 2022, 5:07pm UTC](https://discourse.itk.org/t/linking-itk-with-an-external-project/5481/1 "2022-11-10T17:07:37Z")

</div>

Hi,

I built the latest version of itk using CMake. After configuring my CMakeLists.txt file in as per the instructions online for an external project, I am still getting this error - cannot open source file “itkImage.h”. Could someone please help me in sorting out this issue?  
[CMakeLists.txt](https://discourse.itk.org/uploads/short-url/jZPTiuJF5CP14b49cewIdG55E9L.txt) (479 Bytes)

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [November 10, 2022, 7:59pm UTC](https://discourse.itk.org/t/linking-itk-with-an-external-project/5481/2 "2022-11-10T19:59:18Z")

</div>

Your `CMakeLists.txt` looks correct. Can you share your `new.cpp` as well? And copy-paste the exact compiler error message?

---

<div class="post-metadata">

### Author: ![Ajay\_Emmanuel](https://discourse.itk.org/user_avatar/discourse.itk.org/ajay_emmanuel/32/3038_2.png) [@Ajay\_Emmanuel](https://discourse.itk.org/u/Ajay_Emmanuel)
#### Post date: [November 11, 2022, 4:20pm UTC](https://discourse.itk.org/t/linking-itk-with-an-external-project/5481/3 "2022-11-11T16:20:27Z")

</div>

It is a blank code with just the header files. These are  
the errors that I am getting.  
fatal error: itkImage.h: No such file or directory  
fatal error: itkOpenCVImageBridge.h: No such file or directory

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [November 11, 2022, 4:25pm UTC](https://discourse.itk.org/t/linking-itk-with-an-external-project/5481/4 "2022-11-11T16:25:34Z")

</div>

Can you share your project’s `CMakeCache.txt`?

---

<div class="post-metadata">

### Author: ![Ajay\_Emmanuel](https://discourse.itk.org/user_avatar/discourse.itk.org/ajay_emmanuel/32/3038_2.png) [@Ajay\_Emmanuel](https://discourse.itk.org/u/Ajay_Emmanuel)
#### Post date: [November 11, 2022, 5:18pm UTC](https://discourse.itk.org/t/linking-itk-with-an-external-project/5481/5 "2022-11-11T17:18:43Z")

</div>

[CMakeCache.txt](https://discourse.itk.org/uploads/short-url/wIQOCR1A3CffWBDbywSv41H3u7I.txt) (18.6 KB)

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [November 11, 2022, 7:59pm UTC](https://discourse.itk.org/t/linking-itk-with-an-external-project/5481/6 "2022-11-11T19:59:16Z")

</div>

The only ITK-related content there is:

```auto
//The directory containing a CMake configuration file for ITK.
ITK_DIR:PATH=/usr/local/lib/cmake/ITK-5.2

```

My only conclusion is that your ITK installation is somehow broken. On my computer, for `ITKConfig.cmake` installed in `C:\Dev\PlusGit\andor64\itk-int\lib\cmake\ITK-5.1`, `itkImage.h` is in `C:\Dev\PlusGit\andor64\itk-int\include\ITK-5.1`. How does your `ITKConfig.cmake` look like, and can you find `itkImage.h` in corresponding location?
