0

I am working on an xcode project that requires me to use ITK (a c++ library), I have went through with the installation of ITK, by doing

ccmake InsightToolkit-4.13.1

and then configuring and generating the files, then runing

make
make install

but I do not know how to import the library into the xcode project, where I get the following error every time I try building it:

'itkImage.h' image file not found

enter image description here I would like to know how could I import it and share it with other people on different computers.

Christophe
  • 68,716
  • 7
  • 72
  • 138
Fayad
  • 110
  • 11
  • My advice is to use `CMake` to generate your project for your application. – drescherjm Sep 09 '18 at 18:50
  • But I already have a project and I would like to add this library to it – Fayad Sep 09 '18 at 19:02
  • I understand that. It's just more difficult to do what you want to do. There is information in the itk wiki how to set this up. CMake generates code to setup the factories which you don't get when you don't use it. – drescherjm Sep 09 '18 at 19:11
  • 1
    Here is the info: https://itk.org/ITKExamples/src/IO/ImageBase/RegisterIOFactories/Documentation.html – drescherjm Sep 09 '18 at 19:14
  • 1
    With that said your problem here is a lot more basic. You need to add the include folder for `ITK` to your compiler settings. Also you will have to add libraries to link to your linker settings. I can't tell you how to do that in xcode. – drescherjm Sep 09 '18 at 19:32
  • The thing is I am new to these things and have no experience in them. That is why I am asking, where I am trying to make an osiriX plugin using this library. – Fayad Sep 09 '18 at 19:33
  • Yes, the thing is I am not sure how to add the include file, but thanks :). – Fayad Sep 09 '18 at 19:34
  • You will have read the documentation for `xcode`. – drescherjm Sep 09 '18 at 20:11
  • https://stackoverflow.com/questions/14134064/how-to-set-include-path-in-xcode-project – drescherjm Sep 09 '18 at 20:12

1 Answers1

1

The #include directive comes with two flavors:

  • With quotes (#include "file.h")
  • With ankle brackets (#include <file.h>)

The first usually refers to files relative to your project directory. The second is for system libraries.

You can influence the search path in the project setting:

  • double-click on the project in the project explorer
  • Click on Build settings
  • Click on your target
  • Click on All to view also hidden options
  • In the section Search Paths you can then update the header search path to include the absolute path of you rlibrary headers. Attention: you have to do this for the Debug and for the Release builds:

enter image description here

This will solve the error that you have reported.

Remark: be careful, because after this is solved, you could experience some other issues related to the good use of the library, as pointed out by drescherjm in the comments (link about registration of custom classes to the library's fatories if Cmake is not used to compile the project)

Christophe
  • 68,716
  • 7
  • 72
  • 138