Can't run HelloWorldOTB - New error from new OTB user

I am studying OTB - Building simple OTB code

On windows 10, after installed c:\otb8\OTB-8.0.0-Win64, I created a folder and wrote CMakeLists and HelloWorldOTB.cxx according to Building simple OTB code — Orfeo ToolBox 8.0.1 documentation

Then I setup a folder “build”, ran in cmd :
…\build>cmake -DOTB_DIR=C:/tb8/OTB-8.0.0-Win64/lib/cmake/OTB-8.0/ …
…\build>cmake --build .

Successfully got “…\build\debug\HelloWorldOTB.exe”

Now, the problem is I cannot run HelloWorldOTB.exe.
The errors:

  1. The procedure entry point crc32_combine could not located in the dynamic link library c:\otb8\OTB-8.0.0-Win64\bin\libpng.dll.
  2. The procedure entry point inflateValidate could not located in the dynamic link library c:\otb8\OTB-8.0.0-Win64\bin\gdal302.dll.
  3. The procedure entry point proj_coordoperation could not located in the dynamic link library c:\otb8\OTB-8.0.0-Win64\bin\geotiff.dll.

I can see the three DLLs in c:\otb8\OTB-8.0.0-Win64\bin, and the path environment is right.

Thanks for help.


I figure out that you are trying to build on debug mode, but the dlls present in the OTB 8.0.0 folder are in release mode. Maybe the problem is there, can you try to compile your helloworld by Adding -DCMAKE_BUILD_Type=Release?


just a remark, but there is a typo in your OTB_DIR

Thank you for pointing out. I double checked , this was a mistake I made when I was posting, somehow.

Thank you for your help.
I re-built a release version by:

C:\otb8\mycode\Tutorials\buildf>cmake -DOTB_DIR=C:/otb8/OTB-8.0.0-Win64/lib/cmake/OTB-8.0/ …
– Building for: Visual Studio 16 2019
– Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
– The C compiler identification is MSVC 19.29.30143.0
– The CXX compiler identification is MSVC 19.29.30143.0
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
– Detecting C compile features
– Detecting C compile features - done
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
– Found OpenGL: opengl32
– Configuring done
– Generating done
– Build files have been written to: C:/otb8/mycode/Tutorials/buildf

C:\otb8\mycode\Tutorials\buildf>cmake --build . --config Release
Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Checking Build System
Building Custom Rule C:/otb8/mycode/Tutorials/CMakeLists.txt
HelloWorldOTB.vcxproj → C:\otb8\mycode\Tutorials\buildf\Release\HelloWorldOTB.exe
Building Custom Rule C:/otb8/mycode/Tutorials/CMakeLists.txt

Created a Release folder and the .exe app. But the problem is still there, I cannot run, and errors are same.

I am not sure the “Check for working CXX compiler” message is correct or not.

– Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped

Thank you

Update. I installed OTB-7.1.0-Win64 and tried agian, same problem

Thanks for any help or clue.

I changed another PC with Win10, repeated everything and ran “HelloWorldOTB.exe”。 It works!
So,there is something wrong with my previous PC, or Win10 I guess。

Hi @zlyjob

Good to hear that it works, sometimes the Path is messed up on Windows and things can get tricky to fix. If you find the difference between the two windows PCs, it would be nice to tell the other users if someone encounters the same problem


Hi Romain,
I am trying to figure the difference. But I see an error with the new PC when I was running ninjia to build the whole source code 8.0.0:

[1/272] Performing ZLIB_custom_patch step for ‘ZLIB’
FAILED: ZLIB/src/ZLIB-stamp/ZLIB-ZLIB_custom_patch
cmd.exe /C “cd /D C:\otb8\build_Releasex64 && “C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe” -DSOURCE_DIR=C:/otb8/build_Releasex64/ZLIB/src/ZLIB -DDOT_DIFF_FILES=C:/otb8/src/SuperBuild/patches/ZLIB/zlib-1-debug_fixes-win.diff -DPATCH_ARGS=–binary -P C:/otb8/src/SuperBuild/CMake/patch.cmake && “C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe” -E touch C:/otb8/build_Releasex64/ZLIB/src/ZLIB-stamp/ZLIB-ZLIB_custom_patch”
CMake Error at C:/otb8/src/SuperBuild/CMake/patch.cmake:23 (message):
patch program not found. PATCH_PROGRAM. search names :’ patch’

[6/272] Performing build step for ‘SQLITE’
ninja: build stopped: subcommand failed.

So the situation is:
With the 1st PC, I can build source code but cannot run HelloWorldOTB
With the 2nd PC, I can run HelloWorldOTB.exe which was built from the released bin package, but cannot build source code.

it looks like you have not installed the patch.exe program that you can find here : is it the case?

Let me know

I installed patch and diff, and setup PATH, but didn’t help.

The problem is nothing to do with build. It’s simply the PATH variable you set was not right. Before you run the HelloWorldOTB.exe, you can run the otbenv.bat file in your c:\otb8\OTB-8.0.0-Win64 directory. It will add the c:\otb8\OTB-8.0.0-Win64\bin directory to you PATH variable temporary. Then excute


you will get information

OTB Hello World !

Best regards!


Hi Haijun,
Thank you for your help, it works! After ran otbenv.bat, then HelloWorldOTB.exe, I got it.

I have ever set “path=%path%;C:\otb8\OTB-8.0.0-Win64\bin;C:\otb8\OTB-8.0.0-Win64\lib” but didn’t work. Looks like otbenv.bat must be run.

However, with my other Win10 PC, I directly ran HelloWorldOTB.exe without otbenv.bat, and worked well. I wonder why.

Anyway, the probelm is comppletely solved now. Thank you so much!

The Patch missing issue is solved as well. I fotgot to install the Tools folder on my 2nd PC. Thank you @ thibaut.romain