Photonlib not working in WPILIB 2024 after updating project

After successfully following all the steps in Importing Last Year’s Robot Code — FIRST Robotics Competition documentation and installing the latest vendor dependencies that we use (photonlib, phoenix 5 & 6, & revlib) in 3rd Party Libraries — FIRST Robotics Competition documentation, when we try to build our code, we get many errors. Some of the errors include:

error: ‘Vectord’ was not declared in this scope
313 | Vectord<3> tv;
| ^~~~~~~-

and

error: ‘VersionMatches’ was not declared in this scope; did you mean ‘photon::VersionMatches’?
186 | } else if (!VersionMatches(versionString)) {
| ^~~~~~~~~~~~~~
| photon::VersionMatches

Multiple other errors (24) exist, but they are all similar to the errors shown above. All the code compiled when gradle was on year 2023.

Are these errors in your code or in vendor code? It looks like you may be missing some namespace qualifiers, e.g. Vectord is in the frc namespace (defined in frc/EigenCore.h), it looks like VersionMatches is in the photon namespace, etc.

Yeah, they were in our code

Is this the code that you were updating to 2024? GitHub - bearbotics2358/Smokey-XVII at auto-odometry

It looks like you copied and pasted and old version of PhotonLib into your code base, as well as installed the PhotonLib vendordep. The problem is in the old version of PhotonLib. I suspect that if you delete everything in /src/main/*/photonlib, you’d delete the code that doesn’t compile and it would automatically be replaced by the PhotonLib vendordep.

We can give that a try.

It worked! Thanks!

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