From a095ec2d8f7be48fcf6edfb69d79c01673d783ec Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Sun, 3 Mar 2019 15:39:59 -0800 Subject: [PATCH] Fix linker errors with free functions in Threads.h (#1625) The functions in Threads.h are in the frc namespace. `using namespace frc;` in Threads.cpp doesn't put their implementations in the frc namespace, so linker errors occur when attempting to use them in robot programs. To fix this, one can either wrap them in a namespace block or prepend `frc::` to the implementation's signature. Based on past discussion, I opted for the namespace block. --- wpilibc/src/main/native/cpp/Threads.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wpilibc/src/main/native/cpp/Threads.cpp b/wpilibc/src/main/native/cpp/Threads.cpp index 7713f668ee..efd61a582e 100644 --- a/wpilibc/src/main/native/cpp/Threads.cpp +++ b/wpilibc/src/main/native/cpp/Threads.cpp @@ -12,7 +12,7 @@ #include "frc/ErrorBase.h" -using namespace frc; +namespace frc { int GetThreadPriority(std::thread& thread, bool* isRealTime) { int32_t status = 0; @@ -47,3 +47,5 @@ bool SetCurrentThreadPriority(bool realTime, int priority) { wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status)); return ret; } + +} // namespace frc