Kinda anti-climatic first post on the forum but when I extern motors in my globals.hpp file it gives me an error saying this:
Any idea on what I should do? I’m trying to self-learn PROS myself, trying to transfer from VEXcode Pro V5 to PROS so I’d appreciate the help.
Could you please send the code in the file?
Yes, any time you want meaningful help with a problem please give as much context as possible. Nobody will get anywhere you haven’t without at least something to base their solution on.
Here’s something that might help you. By the way, the switch to PROS is definitely
worth the struggle, and I haven’t even gotten very far myself.
As the link @2990B_DQ has sent says, you most likely forgot to include a header file.
In pros the header file you want to include is main.h
Put that at the top of your code if you haven’t already.
As the PROS docs recommends you should include this in every file.
Hmm I’ve already included the main.h in my files but it still gives the same error. Anything else worth trying? I’ll attach the code underneath for ya.
And from the tutorial I watched there were separate files for opcontrol, autonomous and initialize but the project that I started up complied those 3 files into main.h. Is that normal or do I fix that too?
You probably should not move the default
pros directory into a user added directory (
SubsystemHeaders in your case) because it breaks every single include that references it. For example you will see:
api.h. In the makefile you will see:
This defines the directory containing the Makefile as the project’s root and its subfolder
include as the location where it will look for header files. Since it knows to look for header files in the
include directory, that portion of the path can be omitted from the include statements in
api.h (and any includes in the rest of the project).
This means that an include which looks like
#include "pros/myHeader.h actually resolves to a complete path that may look like
/usr/documents/pros-project/include/pros/myHeader.h. By moving the
pros directory into a user defined directory, you are moving a bunch of important files into an unknown location. You could fix this by updating each relevant include to say
#include "SubsystemHeaders/pros/*.h, but please do not modify any of the provided pros files. I am just trying to show you an example of how it works.
TL;DR you need to remove the
pros directory from
SubsystemHeaders and place it directly in
Once you replace the folder’s location you should build the project and those errors will go away. (You can use the quick action button to build the project) Those errors usually show up the first time someone opens a pros project and hasn’t built it yet. If you have done everything else correctly you should no longer have any errors.
That video is just out of date. PROS currently combines all of those methods into one,
main.cpp file now.
I’ve run into this error a lot (mostly when cloning from github and opening for the first time) but I just save/build and it works perfectly, hehe. It might be different from what you’re facing, though.