.. _core-getting-started: Getting started =============== Native example -------------- CORE is used through small include-level utilities. This example formats a number with explicit settings and constructs a structured diagnostic: .. code-block:: cpp #include #include #include int main() { snt::core::StringFormatType format; format.specifier = 'f'; format.valuePrecision = 2; std::cout << snt::core::number_to_string(12.3456, format) << "\n"; snt::core::Diagnostic diagnostic; diagnostic.severity = snt::core::DiagnosticSeverity::Warning; diagnostic.code = "app.config"; diagnostic.message = "Using the default configuration"; std::cout << diagnostic.message << "\n"; return 0; } The output is ordinary text; CORE does not choose how an application presents diagnostics. A CLI, service, or library can serialize the same fields in its own format. Build and run ------------- Install the C++ package using :doc:`../../installation` with the ``CORE`` module enabled. Save the example above as ``main.cpp`` and create this ``CMakeLists.txt`` in the same directory: .. code-block:: cmake cmake_minimum_required(VERSION 3.22) project(snt_core_example LANGUAGES C CXX) find_package(snt CONFIG REQUIRED) add_executable(application main.cpp) target_compile_features(application PRIVATE cxx_std_17) target_link_libraries(application PRIVATE snt-core) Configure with the installed package prefix, build, and run: .. code-block:: console cmake -S . -B build -DCMAKE_PREFIX_PATH=/path/to/snt cmake --build build ./build/application Expected output: .. code-block:: text 12.35 Using the default configuration Replace ``/path/to/snt`` with the installation prefix; omit that option if CMake already finds SNT. C is enabled for discovery of HDF5 in packages built with DIP support. See :ref:`cmake-consumer` for package discovery details. Continue with :doc:`Workflows ` for exceptions, data-type flags, and process execution. The generated API is documented in the :doc:`C++ API reference <../../api/cpp_core>`.