From 792e735e08f3aff1636e1492a6f64ceb6ebe574c Mon Sep 17 00:00:00 2001 From: David Vo Date: Sun, 16 Jan 2022 03:58:49 +1100 Subject: [PATCH] [wpimath] Move TrajectoryGenerator::SetErrorHandler definition to .cpp (#3920) Otherwise this function causes linking errors when used on Windows. --- .../src/main/native/cpp/trajectory/TrajectoryGenerator.cpp | 5 +++++ .../main/native/include/frc/trajectory/TrajectoryGenerator.h | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/wpimath/src/main/native/cpp/trajectory/TrajectoryGenerator.cpp b/wpimath/src/main/native/cpp/trajectory/TrajectoryGenerator.cpp index 2e2771daca..1884758007 100644 --- a/wpimath/src/main/native/cpp/trajectory/TrajectoryGenerator.cpp +++ b/wpimath/src/main/native/cpp/trajectory/TrajectoryGenerator.cpp @@ -141,3 +141,8 @@ Trajectory TrajectoryGenerator::GenerateTrajectory( config.EndVelocity(), config.MaxVelocity(), config.MaxAcceleration(), config.IsReversed()); } + +void TrajectoryGenerator::SetErrorHandler( + std::function func) { + s_errorFunc = std::move(func); +} diff --git a/wpimath/src/main/native/include/frc/trajectory/TrajectoryGenerator.h b/wpimath/src/main/native/include/frc/trajectory/TrajectoryGenerator.h index 84ec0e0ad4..3df6c89d3e 100644 --- a/wpimath/src/main/native/include/frc/trajectory/TrajectoryGenerator.h +++ b/wpimath/src/main/native/include/frc/trajectory/TrajectoryGenerator.h @@ -119,9 +119,7 @@ class WPILIB_DLLEXPORT TrajectoryGenerator { * * @param func Error reporting function. */ - static void SetErrorHandler(std::function func) { - s_errorFunc = std::move(func); - } + static void SetErrorHandler(std::function func); private: static void ReportError(const char* error);