The import Wpilibj cannot be resolved

I am a third year programmer with this issue being my second occurrence. I opened up my Java program for a sonar sensor and all of the code involving the Wpilibj seems to have errors. These errors are only appearing inside that project. Has anyone else encountered this and or have a fix for this? The first time this appeared was at competition last year and, with help from advisors and other fellow programmers, we were able to copy the code into a different project and have successful code. This seems to happen after the project searches for updates to the wpilib

1 Like

Can you paste a code snippet, as well as the exact error?

Does the code still compile? If so, then it’s just vscode intellisense being weird. If not, then something is weird about your project configuration.

A screenshot of what you’re seeing would help immensely

No, it does not compile. Here is a photo of my issue and my project

I posted an image above

Are you using the old command-based or new command-based? Given the presence of and, I’m going to assume old. If you’re actually using the new one, your imports should be wpilibj2 instead of wpilibj. If this is the case, I recommend creating a new project and migrating functionality piece-by-piece instead of copying entire files.

You should have a json file for one or the other in your vendordeps folder. At quick glance, I don’t see either, though it might simply be off screen.

Assuming you don’t have one, you need to “Manage Vendor Libraries” and “Install Offline”, then select the appropriate one. Making the command-based libraries into vendordeps is new this year.

What do you have in vendordeps?

Definitely odd. What version of WPILib are you running? Also, can you try building, just to see what it does.

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