Code problems

I copied your code and tried to compile it, and this was the complete terminal output that resulted from doing that:

unix build for platform vexv5
CXX src/main.cpp
CXX src/robot-config.cpp
LINK build/test2.elf
build/src/robot-config.o:(.bss.Brain+0x0): multiple definition of `Brain'
build/src/main.o:(.bss.Brain+0x0): first defined here
make: *** [build/test2.elf] Error 1
[error]: make process closed with exit code : 2

The error you quoted (“make process closed with exit code : 2”) just means that something went wrong, and your code didn’t compile as a result. To determine what that is, we need to look further up in the compiler output, specifically at these lines:

build/src/robot-config.o:(.bss.Brain+0x0): multiple definition of `Brain'
build/src/main.o:(.bss.Brain+0x0): first defined here

“Multiple definition” means that you’re initializing an object with the same name (in this case “Brain”) in two different places: once in main.cpp, the other time in robot_config.h.

I took a look at the default robot_config.h (by right-clicking on #include "vex.h", and clicking “Go to Definition”, then doing the same on #include "robot_config.h" to view that file), which VEXcode helpfully told me was “Auto-generated by Graphical Device Configuration”. Here’s what the file looked like on a new project, with no robot connected and having done no configuration:

using namespace vex;

extern brain Brain;

/**
* Used to initialize code/tasks/devices added using tools in VEXcode Text.
*
* This should be called at the start of your int main function.
*/

void vexcodeInit(void);

Sure enough, there’s an instantiation of an object called Brain. Seems like the auto-configurator is initializing that object behind the scenes for you, so it’s no longer necessary to declare it in main.cpp like previous versions did. Removing the declaration of Brain in main.cpp allowed the code to compile.

(As an aside, writing a function with two variables called see and sea is not a great thing to do from a readability standpoint.)