TL;DR
source code (.cpp) should be in the “src” folder, header files (.h) should be in the “include” folder.
The root cause of the problem that @ceak had was project structure, .cpp files should only live in the src folder, they should not be treated like headers and included in other .cpp files. Lets look a bit at the infamous makefile and explain what it does. The makefile and other related build files are hidden by default in a new VEXcode installation, they can be shown by checking “show build files” in the preferences panel.
makefile
# VEXcode makefile 2019_03_26_01
# show compiler output
VERBOSE = 0
# include toolchain options
include vex/mkenv.mk
# location of the project source cpp and c files
SRC_C = $(wildcard src/*.cpp)
SRC_C += $(wildcard src/*.c)
SRC_C += $(wildcard src/*/*.cpp)
SRC_C += $(wildcard src/*/*.c)
OBJ = $(addprefix $(BUILD)/, $(addsuffix .o, $(basename $(SRC_C))) )
# location of include files that c and cpp files depend on
SRC_H = $(wildcard include/*.h)
# additional dependancies
SRC_A = makefile
# project header file locations
INC_F = include
# build targets
all: $(BUILD)/$(PROJECT).bin
# include build rules
include vex/mkrules.mk
a makefile uses a series of rules to decide how to build a project. The default target is “all”, we have a rule in the makefile that explains what the dependancies when building “all” are.
# build targets
all: $(BUILD)/$(PROJECT).bin
$(BUILD) and $(PROJECT) are macros that get expanded when make runs into a directory path. $(PROJECT) is the name of your project, we pass it from VEXcode when we call make. If I’m working on a project called “myproject” then that line would be expanded by make to be;
# build targets
all: build/myproject.bin
myproject.bin is the final output of building the project, the actual file that gets sent to the V5 brain.
Other rules we have are in mkrules.mk, they are a bit more standardized, but in summary
myproject.bin would depend on myproject.elf
myproject.elf depends on all of the .o (object) files.
this is the linking step
the .o files depend on the .c and .ccp (source code) files and also all .h (header) files.
this is the compiling step, the source .cpp files are compiled into .o files
The makefile creates a list of files to be used in the build. It considers the src folder and one additional level of sub directory inside that and looks for all .c and .cpp files. Theses lines in the makefile do that
# location of the project source cpp and c files
SRC_C = $(wildcard src/*.cpp)
SRC_C += $(wildcard src/*.c)
SRC_C += $(wildcard src/*/*.cpp)
SRC_C += $(wildcard src/*/*.c)
It looks in the include folder for header files.
# location of include files that c and cpp files depend on
SRC_H = $(wildcard include/*.h)
it does a few other things, but we can skip those.
This was the original project structure that the OP had.
The file Autonomous.cpp, as an example, would not be compiled and also not used as a dependancy of other source files as it does not have a .h extension (ie. it’s not a header file). These files should live in the src folder and not be treated like headers and included in other .cpp files.
This is a revised project structure that plays nicely with our default makefile.
one new file was added that has global motor and other vex class instances.
more information in this topic on how to use globals and functions defined over several files

