open-telemetry / opentelemetry.io

The OpenTelemetry website and documentation
https://opentelemetry.io
Creative Commons Attribution 4.0 International
524 stars 1.12k forks source link

Page feedback - sample RollDiceServer does not build #5257

Open edibleparts opened 5 days ago

edibleparts commented 5 days ago

https://opentelemetry.io/docs/languages/cpp/getting-started/

Suggested improvements for page: RollDiceServer suggested CMakeLists.txt is out of date and does not include pthread dependency. It fails to build. Corrected CMakeLists.txt (added pthread dependency):

cmake_minimum_required(VERSION 3.25) project(RollDiceServer)

Set C++ standard (e.g., C++17)

set(CMAKE_CXX_STANDARD 17)

find_package(Threads REQUIRED)

Define your project's source files

set(SOURCES main.cpp # Add your source files here )

Create an executable target

add_executable(${PROJECT_NAME} ${SOURCES})

set(OATPP_ROOT ../oatpp) find_library(OATPP_LIB NAMES oatpp HINTS "${OATPP_ROOT}/build/src/" NO_DEFAULT_PATH)

if(NOT OATPP_LIB) message(SEND_ERROR "Did not find oatpp library ${OATPP_ROOT}/build/src") endif()

Set the path to the directory containing "oatpp" package configuration files

target_include_directories(${PROJECT_NAME} PRIVATE ${OATPP_ROOT}/src)

Link libraries to your target

target_link_libraries(${PROJECT_NAME} PRIVATE ${OATPP_LIB}) target_link_libraries(${PROJECT_NAME} PUBLIC Threads::Threads)

Server. when running and serving HTTP requests (those seem to work), does not print anything to terminal.

theletterf commented 5 days ago

@open-telemetry/cpp-approvers Could you check this please?

@edibleparts Feel free to open a PR! Thanks!