various: tidy up various things found when building with a C++ compiler.
Remove duplicate consts. Pull in the include files where functions and variables are declared. Mark file local but duplicated variables as static. Mark some variable declarations as extern. Remove duplicated variable definition. Signed-off-by: Michael Hope <firstname.lastname@example.org>