Prepare the tools and SDK
Install the Visual Studio 2022 C++ desktop tools and CMake. Extract the C++ SDK and confirm its cmake, include, lib and bin directories. Use an x64 toolchain and keep private engine headers out of the project.
Create the CMake project
Create an empty directory and save this as CMakeLists.txt. Kui::Kui is the SDK import target. kui_copy_runtime_dlls copies runtime libraries used by the target.
cmake_minimum_required(VERSION 3.20)
project(forge_kui_first_window LANGUAGES CXX)
if(NOT CMAKE_CXX_STANDARD)
message(FATAL_ERROR "Set CMAKE_CXX_STANDARD to match the selected SDK package.")
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Kui 3 REQUIRED)
add_executable(first_window main.cpp)
target_link_libraries(first_window PRIVATE Kui::Kui)
kui_copy_runtime_dlls(first_window)Create a window
Save the following as main.cpp. The code assigns window settings explicitly. The window displays HTML, a heading and a button. Add application events in the next lesson.
#include <kui/kui.h>
int main() {
kui::Platform::init();
kui::WindowConfig config;
config.title = "Forge KUI";
config.width = 900;
config.height = 640;
auto window = kui::Window::create(config);
if (!window) return 1;
window->document()->loadHTML(R"(
<style>body { padding:48px; font-family:sans-serif; }
button { padding:12px 24px; }</style>
<h1>Hello KUI</h1><button>Save settings</button>
)");
window->show();
return kui::Platform::run();
}Build and check the result
Set Kui_DIR to the extracted SDK cmake directory. The result should show a Hello KUI window and button. For DLL or link failures, first check architecture, Debug/Release configuration and the runtime directory.
$cxxStandard = Read-Host SDK-standard
cmake -S . -B build -A x64 "-DCMAKE_CXX_STANDARD=$cxxStandard" -DKui_DIR="C:/SDK/kui-cpp/cmake"
cmake --build build --config Release
.\build\Release\first_window.exeYour first run, in order
Run commands in the extracted starter project, not the SDK root. The SDK is a dependency; the lesson ZIP is your application.
- Extract the SDK to a stable folder and locate cmake/ KuiConfig.cmake.
- Extract first-window.zip and open the folder containing CMakeLists.txt and main.cpp.
- In PowerShell, enter the standard required by the SDK, configure x64 and build Release.
- Run build/Release/first_window.exe. Confirm Hello KUI appears before editing.
Make one change to verify the build
Change Hello KUI in main.cpp, close the old window, rebuild and run again. The changed heading confirms you launched the current output. The starter button is visual only; it has no save handler yet.
Something unclear?
Report an issue on this page →