From 26f5517e92551c789497cf007ed950a02731e8a3 Mon Sep 17 00:00:00 2001 From: "Tomoya.Fujita" Date: Tue, 4 Aug 2020 17:15:07 +0900 Subject: [PATCH] InitOptions::auto_initialize_logging(true) does not work with assignment operator. https://github.com/ros2/rclcpp/issues/1258 Signed-off-by: Tomoya.Fujita --- CMakeLists.txt | 1 + src/rclcpp_1258.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 src/rclcpp_1258.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 20923f4..6565ed9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,7 @@ custom_executable(rclcpp_1175) #custom_executable(ros2_946_pub) #custom_executable(ros2_946_sub) #custom_executable(ros2_644) +custom_executable(rclcpp_1258) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 6.0) diff --git a/src/rclcpp_1258.cpp b/src/rclcpp_1258.cpp new file mode 100644 index 0000000..7dee534 --- /dev/null +++ b/src/rclcpp_1258.cpp @@ -0,0 +1,17 @@ +#include +#include + +#include + +int main(int argc, char * argv[]) +{ + rclcpp::init(argc, argv); + auto options = rclcpp::InitOptions().auto_initialize_logging(false); + if (options.auto_initialize_logging()) { + std::cout << "options.auto_initialize_logging() is true\n"; + return EXIT_FAILURE; + } else { + std::cout << "options.auto_initialize_logging() is false\n"; + return EXIT_SUCCESS; + } +}