I’m using C++ and run into include errors with everything anyone know how to fix this thanks.
Did you use the WPILib Installer to install VSCode? This is the only recommended and supported way to install AND update between years. You can’t just update the extension.
If the answer is yes, did you use the importer utility in VSCode to import your project?
My team seems to be having the same problem, and we did download Vs Code from WPILIB Installer. And we used the importer to import the project. We even tried making a new example project, and the example had include errors, when we opened it.
I made a brand new project because I couldn’t figure out how to move my project over and that had include errors too.
Are they actual errors (e.g. does compilation fail)? Or is it just Intellisense showing squiggly lines?
It causes errors that prevents it from building
Can you send the errors?
I will when I get back to my laptop tonight
To confirm, you installed everything using the instructions at https://docs.wpilib.org/?
Additionally, could you share the actual build output, not the intellisense warnings. Just run a build and share the output of that.
Lastly, what OS are you on?
Windows and I will put the output when I get back to my laptop tonight and I have had the same problem on my Mac.
I am on windows 10. I downloaded everything according to WPIlib. I tried restarting VsCode, and now the project will build, but I still have errors according to intellisense. Any Idea what that could mean?
cannot open source file “frc/WPILib.h” (dependency of “Robot.h”)
cannot open source file “frc/Commands/Scheduler.h”
{
“resource”: “/c:/Users/sneak/Documents/Proto202/Proto-Imported/src/main/cpp/Robot.cpp”,
“owner”: “C/C++”,
“code”: “1696”,
“severity”: 8,
“message”: “cannot open source file “frc/SmartDashboard/SmartDashboard.h””,
“source”: “C/C++”,
“startLineNumber”: 15,
“startColumn”: 1,
“endLineNumber”: 15,
“endColumn”: 47
}
{
“resource”: “/c:/Users/sneak/Documents/Proto202/Proto-Imported/src/main/cpp/Robot.cpp”,
“owner”: “C/C++”,
“code”: “1696”,
“severity”: 8,
“message”: “#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (C:\Users\sneak\Documents\Proto202\Proto-Imported\src\main\cpp\Robot.cpp).”,
“source”: “C/C++”,
“startLineNumber”: 12,
“startColumn”: 1,
“endLineNumber”: 12,
“endColumn”: 19
}
Check the wpilib_preferences.json file to see what version of WPILib you have
{
"enableCppIntellisense": true,
"currentLanguage": "cpp",
"projectYear": "2020",
I don’t really know what to do in this situation. Try reinstalling or on a different computer.
https://docs.wpilib.org/en/latest/docs/software/wpilib-overview/new-for-2020.html
Deprecated frc/WPILib.h. Instead, include only what you use.
I’ve been having the same problem. It gives me pathing errors on my includes, saying that there is no compiler. But oddly it does still compile no problems.
Sometimes the intellisense engine can get confused. Can you all try the following (Note only follow these if build works, and its only intellisense is not working. If builds are not working, get that fixed first.)
- Close all files but leave VS Code open.
- Run the “Refresh C++ Intellisense” command in the command palette.
- Wait 1 minute. This is important. Do not short this time.
- In the status bar, verify something like
linuxathena (debug)
orlinuxathena (release)
exists. It might be another platform, like your desktop platform. If there is click it and switch to one of the linuxathena ones. - Wait 10 more seconds.
- Open your main C++ file. Not a header.
- Intellisense should now work, and you can open other files.
While wpilib.h is deprecated, it doesn’t cause intellisense errors.