Including a .cpp file in pros

So I am trying to declare my motors and such, and it keeps popping up an error when I try to include the globals.cpp file. Can anyone help me?
image

1 Like

It looks like you need to change “subsystemFiles” to “subsystemheaders”

I don’t think so, the globals.cpp file is under subsystemFiles, not subsystemheaders. globals.hpp is under subsystemheaders.

Why would you need to include the source file if you already included the header? Also, your main.h is looking for the source file under the include directory so it won’t find it.

4 Likes

Oh I didn’t see that, you would want to type ../src/subsystemFiles/globals.cpp

image
I figured it would help with this error. I figured that the globals.hpp just wasn’t receiving the information from globals.cpp to actually name the motor. I’m really new to this, so I was just trying to come up with a solution that I thought would work off the top of my head.
this is the globals.hpp file
image

Also, this did not work, I have tried it already.

I think because you are trying to include something that is not a header file, maybe changing the file extension would help.

Yeah that’s what I was thinking. Like I said, I know basically nothing about this. I was just perplexed as to why it was saying that frontLeft was an undeclared identifier.

@Qaiz_Mohamed_5225A or @5225aChris can you guys help me? I know you guys had insanely good programs using pros.

try remove the ifdef _cpluscplus in your globals.hpp before all the includes.

try saving your files first

1 Like

Yep that’s what it was. Thanks.

2 Likes

Sure! I always check if my files are saved when I run into strange issues. The blue dot in the file name’s tab is a quick indication that you had unsaved changes.

4 Likes

Yep I will make sure to do that from now on.