From 941c5f041f49a67c7d8befdc227eaeb1fe24fda5 Mon Sep 17 00:00:00 2001 From: Felix F Xu <84662027+felixf4xu@users.noreply.github.com> Date: Tue, 2 Dec 2025 13:53:16 +0800 Subject: [PATCH] Windows error (#1) * Undef ERROR to build on Windows Signed-off-by: Felix F Xu * Undef ERROR to build on Windows Signed-off-by: Felix F Xu * Revert ERROR usage --------- Signed-off-by: Felix F Xu --- .../include/diagnostic_aggregator/generic_analyzer_base.hpp | 4 ++++ .../include/diagnostic_aggregator/other_analyzer.hpp | 4 ++++ .../include/diagnostic_aggregator/status_item.hpp | 4 ++++ diagnostic_aggregator/src/aggregator.cpp | 4 ++++ diagnostic_aggregator/src/analyzer_group.cpp | 4 ++++ diagnostic_updater/src/example.cpp | 4 ++++ diagnostic_updater/test/diagnostic_status_wrapper_test.cpp | 4 ++++ diagnostic_updater/test/diagnostic_updater_test.cpp | 4 ++++ self_test/example/selftest_example.cpp | 4 ++++ self_test/test/selftest_node.hpp | 4 ++++ 10 files changed, 40 insertions(+) diff --git a/diagnostic_aggregator/include/diagnostic_aggregator/generic_analyzer_base.hpp b/diagnostic_aggregator/include/diagnostic_aggregator/generic_analyzer_base.hpp index d7cb8a485..f02cce1fc 100644 --- a/diagnostic_aggregator/include/diagnostic_aggregator/generic_analyzer_base.hpp +++ b/diagnostic_aggregator/include/diagnostic_aggregator/generic_analyzer_base.hpp @@ -56,6 +56,10 @@ #include "rclcpp/rclcpp.hpp" +#ifdef ERROR +#undef ERROR //DiagnosticStatus::ERROR conflicts with Windows.h ERROR definition +#endif + namespace diagnostic_aggregator { /*! diff --git a/diagnostic_aggregator/include/diagnostic_aggregator/other_analyzer.hpp b/diagnostic_aggregator/include/diagnostic_aggregator/other_analyzer.hpp index 67d0f1b0a..b4518bde1 100644 --- a/diagnostic_aggregator/include/diagnostic_aggregator/other_analyzer.hpp +++ b/diagnostic_aggregator/include/diagnostic_aggregator/other_analyzer.hpp @@ -48,6 +48,10 @@ #include "rclcpp/rclcpp.hpp" +#ifdef ERROR +#undef ERROR +#endif + namespace diagnostic_aggregator { /* diff --git a/diagnostic_aggregator/include/diagnostic_aggregator/status_item.hpp b/diagnostic_aggregator/include/diagnostic_aggregator/status_item.hpp index e11dad5d6..a04028131 100644 --- a/diagnostic_aggregator/include/diagnostic_aggregator/status_item.hpp +++ b/diagnostic_aggregator/include/diagnostic_aggregator/status_item.hpp @@ -51,6 +51,10 @@ #include "rclcpp/rclcpp.hpp" +#ifdef ERROR +#undef ERROR +#endif + namespace diagnostic_aggregator { /*! diff --git a/diagnostic_aggregator/src/aggregator.cpp b/diagnostic_aggregator/src/aggregator.cpp index 6b60eee32..ccf2d3041 100644 --- a/diagnostic_aggregator/src/aggregator.cpp +++ b/diagnostic_aggregator/src/aggregator.cpp @@ -44,6 +44,10 @@ #include #include +#ifdef ERROR +#undef ERROR +#endif + namespace diagnostic_aggregator { using std::placeholders::_1; diff --git a/diagnostic_aggregator/src/analyzer_group.cpp b/diagnostic_aggregator/src/analyzer_group.cpp index 0873ac4c5..a0b2e66fb 100644 --- a/diagnostic_aggregator/src/analyzer_group.cpp +++ b/diagnostic_aggregator/src/analyzer_group.cpp @@ -44,6 +44,10 @@ #include #include +#ifdef ERROR +#undef ERROR +#endif + PLUGINLIB_EXPORT_CLASS(diagnostic_aggregator::AnalyzerGroup, diagnostic_aggregator::Analyzer) namespace diagnostic_aggregator diff --git a/diagnostic_updater/src/example.cpp b/diagnostic_updater/src/example.cpp index 328c2f717..8556df1c0 100644 --- a/diagnostic_updater/src/example.cpp +++ b/diagnostic_updater/src/example.cpp @@ -38,6 +38,10 @@ #include "rclcpp/rclcpp.hpp" +#ifdef ERROR +#undef ERROR +#endif + using namespace std::chrono_literals; double time_to_launch; diff --git a/diagnostic_updater/test/diagnostic_status_wrapper_test.cpp b/diagnostic_updater/test/diagnostic_status_wrapper_test.cpp index 5cbd2cf0f..8f90b8a6c 100644 --- a/diagnostic_updater/test/diagnostic_status_wrapper_test.cpp +++ b/diagnostic_updater/test/diagnostic_status_wrapper_test.cpp @@ -37,6 +37,10 @@ #include "diagnostic_updater/diagnostic_status_wrapper.hpp" #include "diagnostic_msgs/msg/diagnostic_status.hpp" +#ifdef ERROR +#undef ERROR +#endif + TEST(DiagnosticStatusWrapper, testDiagnosticStatusWrapperDefaultConstructor) { // A default constructed DiagnosticStatusWrapper should be empty. diagnostic_updater::DiagnosticStatusWrapper dsw; diff --git a/diagnostic_updater/test/diagnostic_updater_test.cpp b/diagnostic_updater/test/diagnostic_updater_test.cpp index 0eae2d04b..781602a7e 100644 --- a/diagnostic_updater/test/diagnostic_updater_test.cpp +++ b/diagnostic_updater/test/diagnostic_updater_test.cpp @@ -46,6 +46,10 @@ #include "rclcpp_lifecycle/lifecycle_node.hpp" +#ifdef ERROR +#undef ERROR +#endif + using namespace std::chrono_literals; class TestClass diff --git a/self_test/example/selftest_example.cpp b/self_test/example/selftest_example.cpp index cc5dbd129..5f5ff23c6 100644 --- a/self_test/example/selftest_example.cpp +++ b/self_test/example/selftest_example.cpp @@ -36,6 +36,10 @@ #include "self_test/test_runner.hpp" +#ifdef ERROR +#undef ERROR +#endif + class MyNode : public rclcpp::Node { private: diff --git a/self_test/test/selftest_node.hpp b/self_test/test/selftest_node.hpp index 622bf92ee..89c60be10 100644 --- a/self_test/test/selftest_node.hpp +++ b/self_test/test/selftest_node.hpp @@ -35,6 +35,10 @@ #include "self_test/test_runner.hpp" +#ifdef ERROR +#undef ERROR +#endif + /* *\author Kevin Watts *\brief Returns nominal self-test values