PROS V5 not recognizing default #include files (main.h, okapi/api.hpp)

I am having trouble compiling my PROS code (first time user) due to the program not recognizing other files in the PROS project?
All packages are up to date and I have tried a clean build of the project. The syntax seems correct.
the main errors are :

expected namespace name
‘main.h’ file not found
‘okapi/api.hpp’ file not found

Any Idea to the cause of this? Thanks in advance.
PROSErrors.JPG In the pic it appears your main.h is in a sub-folder “pros” so you need to use

#include "pros/main.h"

also you need to include the okapi api inside the main.h file as explained here.

It doesn’t look like it’s in that subfolder. The subfolder “pros” is closed right now. Look at the arrow beside it.

It does look like there is a path issue, but I don’t know what the default is for pros so I don’t know what to shift.

1 Like

Yea main.h is not in the pros folder, that looks the same as my code. It could be that “big-robot” is in a sub folder of “code” but that should be fine? Start by taking out the include for the okapi api and go into the main.h file and un-comment the include there, it should be about line 43

No luck there, I tried using big-robot as the project folder as well. After making a new project and replacing it’s opcontrol.cpp with my copy it seems to have worked. Strange, because doing a clean build should fix that.

The syntax completion tool is using the root directory to search for paths (the directory with .git, .vscode, code). I’m not sure what that directory is called, so I’ll call it foo. The tool is effectively searching for main.h inside of foo/ and inside of foo/include/. Neither contain the proper header files, so you’re going to see that “main.h file not found” error.

Try opening the PROS project more directly, such that the big-robot folder is the “root” directory. If you’re working with multiple robots, you can add multiple PROS projects and syntax completion will also work.

1 Like

I don’t know if this is still useful right now, but I have the same problem previously and solved it

In my situation there are some other projects/folders open such as “system 32”, “desktop” etc. I think there are some interference issues between them since after closing them, the error “main.h file not found disappeared”

1 Like

Just an interesting piece of knowledge for future reference :slight_smile:
I had the exact same problem right now. You can actually identify the files that are being #include by their relative file path, as to the file that you are doing the including in. An example would be

Original: #include “main.h”
Fixed: #include “…/include/main.h”

(The … means to move up one file directory.)
In short, this method should work, however it is extremely tedious to complete for every single #include in all these files.