# Problem in parsing ITK\_LIBRARIES

**URL:** <https://discourse.itk.org/t/problem-in-parsing-itk-libraries/874>\
**Category:** Beginner Questions\
**Created:** [April 27, 2018, 11:21am UTC](https://discourse.itk.org/t/problem-in-parsing-itk-libraries/874 "2018-04-27T11:21:29Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mabou](https://discourse.itk.org/letter_avatar_proxy/v4/letter/m/bbce88/32.png) [@mabou](https://discourse.itk.org/u/mabou)\
**Post date:** [April 27, 2018, 11:21am UTC](https://discourse.itk.org/t/problem-in-parsing-itk-libraries/874/1 "2018-04-27T11:21:33Z")

</div>

I am trying to run a simple HelloWorld program, and make an inclusion of header file of ITK: itkImage.h.

Running cmake …/src to build the Makefile is okay. But running make all gives this error: /src/HelloWorldTwo.cpp:10:22: fatal error: itkImage.h: No such file or directory  
#include “itkImage.h”

Find below my CMakeLists.txt file and HelloWorldTwo.cpp, and debugging variables. I knew that ITK\_LIBRARIES should be semicolon separated, but they aren’t! I wonder what I should check? Or what I did wrong in first place?

**CMakeLists.txt:**  
cmake\_minimum\_required(VERSION 3.6.2)  
project(HelloWorldTwo)  
set(ITK\_DIR “/home/usr/itk/lib/cmake/ITK-4.13”)  
find\_package(ITK REQUIRED)  
include(${ITK\_USE\_FILE})  
add\_executable(HelloWorldTwo HelloWorldTwo.cpp)  
target\_link\_libraries(HelloWorldTwo ${ITK\_LIBRARIES})  
MESSAGE( STATUS "ITK\_DIR: " ${ITK\_DIR} )  
MESSAGE( STATUS "ITK\_LIBRARIES: " ${ITK\_LIBRARIES} )  
MESSAGE( STATUS "ITK\_USE\_FILE: " ${ITK\_USE\_FILE} )

**HelloWorldTwo.cpp:**  
#include “iostream”  
#include “itkImage.h”  
using namespace std;  
int main() {  
cout \<\< “Hello World!!!” \<\< endl; // prints Hello World!!!  
return 0;  
}

**Debugging the variables in CMakeLists.txt:**  
– ITK\_DIR: /home/usr/itk/lib/cmake/ITK-4.13  
– ITK\_USE\_FILE: /home/usr/itk/lib/cmake/ITK-4.13/UseITK.cmake  
– ITK\_LIBRARIES: itkdouble-conversionitksysitkvnl\_algoitkvnlitkv3p\_netlibitknetlibitkvclITKCommonitkNetlibSlatecITKStatisticsITKTransformITKLabelMapITKMeshitkzlibITKMetaIOITKSpatialObjectsITKPathITKQuadEdgeMeshITKIOImageBaseITKOptimizersITKPolynomialsITKBiasCorrectionITKBioCellITKDICOMParserITKEXPATITKIOXMLITKIOSpatialObjectsITKFEMgdcmDICTgdcmMSFFITKznzITKniftiioITKgiftiiohdf5\_cpp-statichdf5-staticITKIOBMPITKIOBioRadITKIOBrukerITKIOCSVITKIOGDCMITKIOIPLITKIOGEITKIOGIPLITKIOHDF5itkjpegITKIOJPEGitktiffITKIOTIFFITKIOLSMitkminc2ITKIOMINCITKIOMRCITKIOMeshITKIOMetaITKIONIFTIITKNrrdIOITKIONRRDitkpngITKIOPNGITKIOSiemensITKIOStimulateITKTransformFactoryITKIOTransformBaseITKIOTransformHDF5ITKIOTransformInsightLegacyITKIOTransformMatlabITKIOVTKITKKLMRegionGrowingitklbfgsITKOptimizersv4itkopenjpegITKVTKITKWatershedsITKReviewITKVideoCoreITKVideoIOITKVtkGlue

---

<div class="post-metadata">

**Author:** ![jhlegarreta](https://discourse.itk.org/user_avatar/discourse.itk.org/jhlegarreta/32/476_2.png) [@jhlegarreta](https://discourse.itk.org/u/jhlegarreta)\
**Post date:** [April 27, 2018, 11:31am UTC](https://discourse.itk.org/t/problem-in-parsing-itk-libraries/874/2 "2018-04-27T11:31:55Z")

</div>

Not sure what’s wrong in your `CMakeList.txt` at first sight (I’d think of `ITK_DIR` or the way you built ITK), you may find it **useful to visit the  
 [BuildAHelloWorldProgram](https://itk.org/ITKExamples/src/Core/Common/BuildAHelloWorldProgram/Documentation.html) example** to get you started with a simple ITK program.

HTH.

---

<div class="post-metadata">

**Author:** ![mabou](https://discourse.itk.org/letter_avatar_proxy/v4/letter/m/bbce88/32.png) [@mabou](https://discourse.itk.org/u/mabou)\
**Post date:** [April 27, 2018, 11:40am UTC](https://discourse.itk.org/t/problem-in-parsing-itk-libraries/874/3 "2018-04-27T11:40:27Z")

</div>

But ITK\_DIR contains the files needed to include ITK\_LIBRARIES: (ITKconfig.cmake) and other files as well.  
I have checked the example you mentioned, and it is typically what I am doing. I think my issue concerns ITK\_LIBRARIES. Do you have them separated by semicolon?

---

<div class="post-metadata">

**Author:** ![jhlegarreta](https://discourse.itk.org/user_avatar/discourse.itk.org/jhlegarreta/32/476_2.png) [@jhlegarreta](https://discourse.itk.org/u/jhlegarreta)\
**Post date:** [April 27, 2018, 11:50am UTC](https://discourse.itk.org/t/problem-in-parsing-itk-libraries/874/4 "2018-04-27T11:50:08Z")

</div>

No, that’s not likely the issue: they are not separated with commas in my case either.

---

<div class="post-metadata">

**Author:** ![phcerdan](https://discourse.itk.org/user_avatar/discourse.itk.org/phcerdan/32/286_2.png) [@phcerdan](https://discourse.itk.org/u/phcerdan)\
**Post date:** [April 27, 2018, 1:16pm UTC](https://discourse.itk.org/t/problem-in-parsing-itk-libraries/874/5 "2018-04-27T13:16:07Z")

</div>

> [@mabou](#):
>
> target\_link\_libraries(HelloWorldTwo ${ITK\_LIBRARIES})

Let us know what happen if you try:

```auto
target_link_libraries(HelloWorldTwo PUBLIC ${ITK_LIBRARIES})

```

---

<div class="post-metadata">

**Author:** ![phcerdan](https://discourse.itk.org/user_avatar/discourse.itk.org/phcerdan/32/286_2.png) [@phcerdan](https://discourse.itk.org/u/phcerdan)\
**Post date:** [April 27, 2018, 1:21pm UTC](https://discourse.itk.org/t/problem-in-parsing-itk-libraries/874/6 "2018-04-27T13:21:50Z")

</div>

> [@mabou](#):
>
> HelloWorldTwo.cpp:
> 
> #include  
> #include “itkImage.h”  
> using namespace std;  
> int main() {

Also, there is a lonely `#include` there, not sure if your `.cpp` file is like that or just a typo copying it here.

---

<div class="post-metadata">

**Author:** ![mabou](https://discourse.itk.org/letter_avatar_proxy/v4/letter/m/bbce88/32.png) [@mabou](https://discourse.itk.org/u/mabou)\
**Post date:** [April 27, 2018, 2:46pm UTC](https://discourse.itk.org/t/problem-in-parsing-itk-libraries/874/7 "2018-04-27T14:46:44Z")

</div>

It gives same result. And secondly, it is just typo: it is #include “iostream”

---

<div class="post-metadata">

**Author:** ![phcerdan](https://discourse.itk.org/user_avatar/discourse.itk.org/phcerdan/32/286_2.png) [@phcerdan](https://discourse.itk.org/u/phcerdan)\
**Post date:** [April 27, 2018, 3:14pm UTC](https://discourse.itk.org/t/problem-in-parsing-itk-libraries/874/8 "2018-04-27T15:14:59Z")

</div>

I cannot reproduce it 😕. It works for me using:

`HelloWorldTwo.cpp`

```cpp
#include <iostream>
#include "itkImage.h"
using namespace std;
int main() {
cout << "Hello World!!!" << endl; // prints Hello World!!!
return 0;
}

```

```auto
cmake_minimum_required(VERSION 3.6.2)
project(HelloWorldTwo)
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})
add_executable(HelloWorldTwo HelloWorldTwo.cpp)
target_link_libraries(HelloWorldTwo ${ITK_LIBRARIES})
MESSAGE( STATUS "ITK_DIR: " ${ITK_DIR} )
MESSAGE( STATUS "ITK_LIBRARIES: " ${ITK_LIBRARIES} )
MESSAGE( STATUS "ITK_USE_FILE: " ${ITK_USE_FILE} )

```

and running it with `cmake -DITK_DIR:PATH=/path/cmake/ITK ../src`

Maybe you can try to set `ITK_DIR` with cmake interface (or `ccmake`) instead of hard-coding it in `CMakeLists.txt`?  
Umm, not sure what’s going on, maybe somebody else has a clue. I would recommend to try in a new `build` folder to start in a clean state.
