Hello World
Every SDK needs a smoke test, and this is Holoscan’s: the smallest possible
program that proves the SDK headers, the holoscan::core library, and your
build configuration all work together. There are no operators, no graph, and
no runtime here — just one function call. If this example builds and prints
its greeting, your toolchain is ready for everything else in
Holoscan by Example.
- What the
hello_worldexample does and why it exists. - The minimal SDK availability check:
holoscan::hello(). - The smallest
CMakeLists.txtthat links againstholoscan::core. - How to build and run the example, and what success looks like.
The entire program
The example lives at public/examples/hello_world/ in the SDK tree. The source is
one file, hello_world.cpp:
That is the whole application. Two things are being exercised:
- Headers resolve.
<holoscan/holoscan.hpp>is the SDK’s umbrella header — it pulls in the full core API surface (operators, graphs, time, parameters, payloads). If this include compiles, your include paths and compiler configuration are correct. - The library links and runs.
holoscan::hello()is a tiny exported function in theholoscan::corelibrary that prints a greeting to standard output. If the call links and executes, your linker setup and runtime library loading are correct too.
holoscan::hello() exists purely as this availability check — it has no role
in real applications. Think of it as the SDK’s ping.
The build file
The standalone CMakeLists.txt shows the minimal recipe for building any
application against an installed SDK:
Three lines carry the weight:
find_package(holoscan REQUIRED)locates the SDK’s CMake package configuration through CMake’s normal package search paths. SetCMAKE_PREFIX_PATHorHoloscan_ROOTif the SDK is installed in a non-standard prefix.target_link_libraries(... holoscan::core)links the core runtime. This one imported target brings the include directories, compile features, and library dependencies with it — no manual-I/-Lflags.
This same pattern — find_package(holoscan) plus holoscan::core — is the
starting point for every application you build outside the SDK tree.
If find_package(holoscan ...) fails with a “could not find a package
configuration file” error, the SDK is not installed where CMake is looking.
Verify your installation prefix and pass it explicitly, for example
cmake -DCMAKE_PREFIX_PATH=/path/to/holoscan/install ... A “CMake 4.0 or
higher is required” error means your CMake is too old. See
SDK Installation.
Build and run
From the example directory, configure, build, and run with standard CMake:
What success looks like
The program prints one line and exits with status 0:
That single line confirms the full chain: headers found, library linked,
binary runs. The SDK’s own test suite checks exactly this — the example’s
CTest entry passes when the output matches Hello Holoscan!.
If you got the greeting, your environment is ready. The next example introduces the real programming model: operators, graphs, and the compose → compile → run flow.
Recap
hello_worldis the SDK availability check: one call toholoscan::hello(), no operators, no graph.<holoscan/holoscan.hpp>is the umbrella header for the entire core API.- The minimal build recipe is
find_package(holoscan REQUIRED)plus linkingholoscan::core. - Success is the single line
Hello Holoscan!and a zero exit status. - Next: Hello Tour — a guided
walk through the
hello_*examples that introduce each core concept.