[help] [error]: make process closed with exit code : 2

I’m trying to build a project, but failed. I searched the problem, but no avalibable solution. The code is cloned from others.

using namespace vex;

extern brain Brain;

// VEXcode devices

 * Used to initialize code/tasks/devices added using tools in VEXcode Pro.
 * This should be called at the start of your int main function.
void  vexcodeInit( void );

Here comes the info:

[info]: Saving Project ...
[info]: Project saved!
windows build for platform vexv5
"CXX src/robot-config.cpp"
src/robot-config.cpp:8:8: error: redefinition of 'Brain'
brain  Brain;
include\vex.h:24:12: note: previous definition is here
vex::brain Brain;
1 error generated.
make: *** [vex/mkrules.mk:13: build/src/robot-config.o] Error 1
[error]: make process closed with exit code : 2

I think it means you have accidentally defined your brain twice, is the code in your original post the entire code?

Yeah, the brain gets declared automatically, no need to add that yourself.


that is all the code in vex.h. there’s no “brain” in main.cpp except “brain.timer();”. is it caused by “extern brain Brain”?

No, its because you have Brain declared again in robot-config.cpp on like 8