Compile problems from a rookie about to start using otb

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”)

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)


Hi! Thank you for replying!
I’ve been following the steps on this website:
Building simple OTB code — Orfeo ToolBox 9.0.0 documentation

And below is my Cmakelist:

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)


cmake_minimum_required(VERSION 3.1.0)

  message(FATAL_ERROR "Cannot build OTB project without OTB.  Please set OTB_DIR.")

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

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 ?