Code won't build due to Phoenix 6 Library Conflict

Hello, we’re having a problem with our code where it fails to build due to using the Phoenix 5 library. Although there are no errors, the build fails as it says Phoenix 5 is a deprecated library and we should switch to Phoenix 6. This is a problem for us as we are using CANTalonSRX’s, and the relevant objects from Phoenix 5 are not available in Phoenix 6. How can we continue using CANTalonSRX’s in our code? Here is the error log when we build. 1-27-24 error - Pastebin.com

Any and all help is greatly appreciated! My team’s code can be found here Thank you!

The deprecation is just a warning, but it is burying the actual error. Your actual error is

C:\Users\Robotics1\Documents\2024-Imported\src\main\include\subsystems\SwerveModule.h(60): error C2039: 'PIDController': is not a member of 'frc2'
C:\Users\Robotics1\.gradle\caches\transforms-3\565d47e3775b9313fdd732099e133bee\transformed\wpilibNewCommands-cpp-2024.2.1-headers\frc2/command/SubsystemBase.h(15): note: see declaration of 'frc2'
C:\Users\Robotics1\Documents\2024-Imported\src\main\include\subsystems\SwerveModule.h(60): error C3646: 'm_drivePIDController': unknown override specifier
C:\Users\Robotics1\Documents\2024-Imported\src\main\include\subsystems\SwerveModule.h(60): error C2059: syntax error: '{'
C:\Users\Robotics1\Documents\2024-Imported\src\main\include\subsystems\SwerveModule.h(60): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
1 Like

It’s not warning about your CANTalonSRX’s. It’s warning about your TalonFX’s and CANCoders. If you want to get rid of the deprecation warning, change the TalonFX and CANCoders to Phoenix 6. The deprecation warning says you’ll have to switch the TalonFX and CANCoders next year. Your choice if you do that this year.

The code you have on github doesn’t match what’s generating the errors, so it makes it hard to help debug. It’s 2023 code and vendordeps on github, but the deprecation warnings are coming from the 2024 Phoenix vendordep.

1 Like

There’s actually a bug in CTRE’s library where even including CANTalonSRX will spew deprecation warnings in C++. Its unavoidable.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.