# Compile problems from a rookie about to start using otb

**URL:** <https://forum.orfeo-toolbox.org/t/compile-problems-from-a-rookie-about-to-start-using-otb/1768>\
**Category:** OTB Usage\
**Created:** [May 26, 2024, 3:27pm UTC](https://forum.orfeo-toolbox.org/t/compile-problems-from-a-rookie-about-to-start-using-otb/1768 "2024-05-26T15:27:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yezify](https://forum.orfeo-toolbox.org/user_avatar/forum.orfeo-toolbox.org/yezify/32/1300_2.png) [@Yezify](https://forum.orfeo-toolbox.org/u/Yezify)\
**Post date:** [May 26, 2024, 3:27pm UTC](https://forum.orfeo-toolbox.org/t/compile-problems-from-a-rookie-about-to-start-using-otb/1768/1 "2024-05-26T15:27:25Z")

</div>

I’m just about to start code a project using otb’s C++ API.

**My system** : Windows11  
**Version of the OTB** : 9.0

When I was following the steps in C++ API tutorials, I stuck at the step to cmake the helloworld program. Below are the errors in my terminal, and I’m not sure what to do with this.

1.Target “HelloWorldOTB” links to: Boost::filesystem  
but the target was not found.  
2. The link interface of target “OTBCurlAdapters” contains: CURL::libcurl  
but the target was not found.  
3. The link interface of target “OTBSupervised” contains: Boost::serialization  
but the target was not found.

I guess I might have set OTB\_DIR correctly as below:  
set (OTB\_DIR “C:\Users\67006\Desktop\OTB-9.0.0-Win64\lib\cmake\OTB-9.0”)  
set (ITK\_DIR “C:\Users\67006\Desktop\OTB-9.0.0-Win64\lib\cmake\ITK-4.13”)

---

<div class="post-metadata">

**Author:** ![thibaut.romain](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/t/ecc23a/32.png) [@thibaut.romain](https://forum.orfeo-toolbox.org/u/thibaut.romain)\
**Post date:** [May 29, 2024, 8:01am UTC](https://forum.orfeo-toolbox.org/t/compile-problems-from-a-rookie-about-to-start-using-otb/1768/2 "2024-05-29T08:01:45Z")

</div>

Hi @Yezify

The support on windows platform is not at the same level as on Linux but maybe I can help.

- Can you provide the full CMake command that you call ?  
It guess you are trying to compile it directly from the official package? You don’t build from source?

- Can you also provide the command line to build helloworldOTB ?  
It looks like it is missing a find\_package(Boost REQUIRED COMPONENTS filesystem serialization)

Thanks

---

<div class="post-metadata">

**Author:** ![Yezify](https://forum.orfeo-toolbox.org/user_avatar/forum.orfeo-toolbox.org/yezify/32/1300_2.png) [@Yezify](https://forum.orfeo-toolbox.org/u/Yezify)\
**Post date:** [May 29, 2024, 12:37pm UTC](https://forum.orfeo-toolbox.org/t/compile-problems-from-a-rookie-about-to-start-using-otb/1768/3 "2024-05-29T12:37:22Z")

</div>

Hi! Thank you for replying!  
I’ve been following the steps on this website:  
[Building simple OTB code — Orfeo ToolBox 9.0.0 documentation](https://www.orfeo-toolbox.org/CookBook/C%2B%2B/Tutorial.html#hello-world)

And below is my Cmakelist:

```auto
set (OTB_DIR "L\\OTB-9.0.0-Win64\\lib\\cmake\\OTB-9.0")
set (ITK_DIR "L\\OTB-9.0.0-Win64\\lib\\cmake\\ITK-4.13")
set (Boost_INCLUDE_DIR "L\\OTB-9.0.0-Win64\\include\\boost-1_82")
set (Boost_LIBRARY_DIR "L\\OTB-9.0.0-Win64\\lib\\Boost-1.82.0")

find_package(Boost REQUIRED COMPONENTS filesystem)

project(Tutorials)

cmake_minimum_required(VERSION 3.1.0)

find_package(OTB)
if(OTB_FOUND)
  include(${OTB_USE_FILE})
else(OTB_FOUND)
  message(FATAL_ERROR "Cannot build OTB project without OTB. Please set OTB_DIR.")
endif(OTB_FOUND)

add_executable(HelloWorldOTB HelloWorldOTB.cxx )
target_link_libraries(HelloWorldOTB ${OTB_LIBRARIES})

```

I’ve also noticed that my Cmake can’t find the boost package. So I tried to add the first 4 lines of code.

And I got some new error message after using “cmake ./” in my cmd, which are:

CMake Error at C:/Program Files/CMake/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:230 (message):  
Could NOT find Boost (missing: filesystem) (found version “0.0.0”)  
Call Stack (most recent call first):  
C:/Program Files/CMake/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:600 (\_FPHSA\_FAILURE\_MESSAGE)  
C:/Program Files/CMake/share/cmake-3.29/Modules/FindBoost.cmake:2393 (find\_package\_handle\_standard\_args)  
CMakeLists.txt:7 (find\_package)

Thank you

---

<div class="post-metadata">

**Author:** ![thibaut.romain](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/t/ecc23a/32.png) [@thibaut.romain](https://forum.orfeo-toolbox.org/u/thibaut.romain)\
**Post date:** [May 29, 2024, 4:09pm UTC](https://forum.orfeo-toolbox.org/t/compile-problems-from-a-rookie-about-to-start-using-otb/1768/4 "2024-05-29T16:09:23Z")

</div>

the Boost\_LIBRARY\_DIR is not right as the libs are in OTB-9.0.0-Win64\lib, but i don’t know why it can’t find Boost, can you try :  
`cmake . -DCMAKE_PREFIX_PATH=/PathTo/OTB-9.0.0-win64/lib/cmake` or even without lib/cmake at the end ?
