I have a VEX project on my native machine that works great and compiles. I’ve setup a Repository within GitHub and moved my project to the repository. When I open the code in VS Code (I only use VEX VS Code extension) from our repository i get an error on all my “#include fileName.h” lines of code that reads,
“#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (C:\Code\HighStakes-Code-24-25\Neg-RedSideAuton\src\main.cpp).”
The error also reads, "cannot open source file ‘fileName.h’ "
When I go into the includePath settings there is not a compiler path detected in the compiler path GUI in the C/C++ configuration tab.
Any help or suggestions to resolve this issue would be greatly appreciated.
I don’t why git would cause this problem, but try changing your include path to the correct repo. If you’re using #include "src/auton.h"
make the include path C:\Code\HighStakes-Code-24-25\Neg-RedSideAuton\
.
Where was the .git file made? That might tell you what it thinks the repo structure is.
Changing the include path does not seem to be working. I have cloned the repository to a different device and I am still getting the same issue. I think it may have something to do with the git ignore but I don’t know how to go about fixing it. If you or any one would like to take a look I’ll link the GitHub page.
https://github.com/TheronTyler/HighStakes-Code-24-25
Are you cloning the project to another computer or the same one?
Does your project build after its been clone?
What directory did you open the project at?
Was it the project directory or the top level directory of your repository?
1 Like
I’ll be transparent, I don’t know a ton of code and it’s intricacies, so I’m blind to all the vocabulary and processes that are used. One of my teammates was able to clone the repository onto his PC and the code works perfectly fine. This leads me away from my hypothesis of a git ignore problem and toward the fact that the issue may be related to a compiler path issue.
To answer your questions:
I made the repository on my laptop as well as the original code, I then moved the code into the repository and pushed to GitHub. When the code was open via its original file path it worked but when it was opened on my laptop via the repositor I was encountering the issue that prompted this conversation. I then went onto my PC and cloned the repositor onto the new device and still had that issue.
The project does not build due to the errors in it.
Not sure what you mean in your third or last question. I don’t know what a directory is. I’m sure I have them, just not sure what they are.
1 Like
No worries its all good!
A directory is just a folder on your computer.
I don’t believe its a compile path issue. The VEX Extension sets up the build environment for you regardless of the settings specified in the c_cpp_properties.json file.
Can you post the build output?
You can find it here after you build your project:
Its possible that the project could still build and its just an intellesense issue cause by a change in the c_cpp_properties.json file. In order to determine whether its a build error or intellesense issue, I need to see if your project builds.
You can build your project clicking the following button in the toolbar.

2 Likes
So did you open up this folder in vscode,
HighStakes-Code-24-25-main
which is the top level folder located in your repository.

Or your project folder in vscode,
Neg-RedSideAuton

Make sure you open the folder named ‘Neg-RedSideAuton’ within vscode
If you open the wrong folder, vscode won’t be able to properly resolve your includes because it can’t find the c_cpp_properties.json
file located within the .vscode
folder.
1 Like
I have been opening the code from the top level repository. After opening it from the folder named ‘Neg-RedSideAuton’ I am not getting any of the include path errors, but I am still unable to build the code.
I am still unable to build via the build button or (ctrl + b). This is what I am receiving:
These errors are just “real” errors in your code. You are not really using header files correctly, they have C++ source code in them, so including devices.h more than once redefines those global variables, that’s what the errors are telling you.
1 Like
To add on to this, I would like to explain how C++ linking works, for future programmers.
A .h or header file is used for definitions in a translation unit (basically a .h and .cpp combined). .cpp files are used for the actual “code”. You need to use #pragma once
at the top of .h files to avoid more errors. (I know there are other ways but this is the simplest)
You can make functions, variables, classes, etc., but can’t really define them. They would be made like this
void doStuff(int param1, float param2);
In the .cpp file (usually with the same name eg. robot.h
and robot.cpp
) you NEED to include the corresponding header file
#include "robot.h"
then you make the body of the variables and functions, like this
void doStuff(int param1, float param2)
{
//Do stuff
}
This is so when you include the header file (you include the header file when you want to use stuff, NOT the cpp file), you don’t include the actual variables and functions more than once. This causes redefinition issues. If the header file only has code that lets the compiler know that they exist, but they’ve been made somewhere else, it’s not considered redefinition.
If I didn’t explain that well, here’s an article on it.
TLDR; Header files have function, class, and variables definitions. Cpp files have the actual code to make them work.
No.
Header files have function and variable declarations
The .cpp files have the definitions.
6 Likes
I removed the devices.h file from main.cpp because devices.h was already included in the turnHeading.h file, the code builds now. Not too sure about the explanation of header files given, but ill read up.
Sorry if my explanation wasn’t very clear. I know @jpearman clarified at least one of the mistakes I made.