I’m kinda new to coding for VEX and after reading about how annoying VCS was, I decided to try the RMS CLI with VSCode. I couldn’t find a competition template online, so I created a RMS account and copied the template on their website into VSCode (I’ve copied the code below). However, I’m getting 2 errors:
#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (C:\Users\tarun\VEX Robotics (RMS)\Competition Template.cpp).
cannot open source file “vex.h”
How do I fix these errors?
// VEX V5 C++ Project with Competition Template
#include "vex.h"
using namespace vex;
// Creates a competition object that allows access to Competition methods.
vex::competition Competition;
void pre_auton() {
// All activities that occur before competition start
// Example: setting initial positions
}
void autonomous() {
// Place autonomous code here
}
void drivercontrol() {
// Place drive control code here, inside the loop
while (true) {
// This is the main loop for the driver control.
// Each time through the loop you should update motor
// movements based on input from the controller.
}
}
int main() {
// Do not adjust the lines below
// Set up (but don't start) callbacks for autonomous and driver control periods.
Competition.autonomous(autonomous);
Competition.drivercontrol(drivercontrol);
// Run the pre-autonomous function.
pre_auton();
// Robot Mesh Studio runtime continues to run until all threads and
// competition callbacks are finished.
}
Right, because rmbuild knows where vex.h is but the intellisense in VScode does not. I was playing around with a bit after seeing your post, and just telling it where vex.h was wasn’t quite enough. I’ll poke at it some more, but I wouldn’t get your hopes up too high that I’ll have spare time to produce anything sophisticated any time soon.
This FAQ suggests you most likely would want to add the path containing vex.h to both"includePath" and "browse.path" inside your c_cpp_properties.json.
Here is an example of a modified "browse.path". The same format should be used for modifying "includePath".
${workspaceRoot} is essentially a “placeholder” (variable) that VSCode will “fill in” behind-the-scenes with the main (top-level) folder containing the code you are working on. That is why it is listed in both sections as a path — because it is, to the computer.
Correct. You will just need to add commas in both lists after the closing quotation marks of "${workspaceRoot}" so VSCode knows that you are listing two separate paths.
@tp3208@Barin
It’s installed with rmbuild. Sorry for the slow reply, I was trying to assemble a list of all the directories you need to point VScode at. There are a couple duplicates in different places in the rmbuild directory and I’m not entirely sure which versions we actually link against. I’ll need to ask the boss when he gets into the office today.
For starters, vex.h is in your rmbuild install directory under \rmbuild\vexv5-cpp\. There are other directories you’ll need, unfortunately. You could try having it do everything under \rmbuild\, but there’s no guarantees it’s going to pick the right versions for those duplicates I mentioned.
I’m getting these errors in the c_cpp_properties.json:
Invalid escape character in string.json(261) [7, 17]
Invalid escape character in string.json(261) [18, 17]
Path is not a directory: “C:\Program Files (x86)\RobotMesh\rmbuild\vexv5-cpp\vex.h”.[7, 17]
Path is not a directory: “C:\Program Files (x86)\RobotMesh\rmbuild\vexv5-cpp\vex.h”.[18, 17]
I’m getting these errors in the Competition Template.cpp (copied in my original post):
#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (C:\Users\tarun\FHSRobotics1000\Competition Template.cpp)."[2, 1]
cannot open source file “stdint.h” (dependency of “vex.h”)",[2, 1]
You need to change all of the slashes in your paths to be double-slashes, as shown in the example.
Backslashes are normally read as “escape characters,” which allow you to include special characters such as quotation marks inside strings. In this case, though, you want the backslashes included in the strings, so you need to “escape” the backslashes by placing another backslashes immediately before each of them.