From 86291024e05b33790342c84405099c1caefe884b Mon Sep 17 00:00:00 2001 From: Tobias Fischer Date: Fri, 3 Jan 2025 15:08:33 +1000 Subject: [PATCH 1/2] Fix error C3861: 'usleep': identifier not found on Windows --- tools/topic_tools/src/mux.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/topic_tools/src/mux.cpp b/tools/topic_tools/src/mux.cpp index c7ff5f2816..bd27fdfe8a 100644 --- a/tools/topic_tools/src/mux.cpp +++ b/tools/topic_tools/src/mux.cpp @@ -157,7 +157,7 @@ void in_cb(const boost::shared_ptr& msg, // we need sleep for publisher initialization // otherwise the first topic will drop. if (g_wait_pub_init) { - usleep(g_wait_second * 1000000); + std::this_thread::sleep_for(std::chrono::microseconds(g_wait_second * 1000000)); } g_advertised = true; From d5990aab855f9b80ad9398f732a7071ba00135a6 Mon Sep 17 00:00:00 2001 From: Tobias Fischer Date: Fri, 3 Jan 2025 16:07:12 +1000 Subject: [PATCH 2/2] Fixup --- tools/topic_tools/src/mux.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/topic_tools/src/mux.cpp b/tools/topic_tools/src/mux.cpp index bd27fdfe8a..dd7363019c 100644 --- a/tools/topic_tools/src/mux.cpp +++ b/tools/topic_tools/src/mux.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include "ros/console.h" #include "std_msgs/String.h" #include "topic_tools/MuxSelect.h" @@ -157,7 +158,7 @@ void in_cb(const boost::shared_ptr& msg, // we need sleep for publisher initialization // otherwise the first topic will drop. if (g_wait_pub_init) { - std::this_thread::sleep_for(std::chrono::microseconds(g_wait_second * 1000000)); + std::this_thread::sleep_for(std::chrono::microseconds(static_cast(g_wait_second * 1000000))); } g_advertised = true;