I am attempting to transition to a more organized project structure. I am having several issues that issues that seem to stem from my lack of understanding of the pre-process, compile, linking process.
My current (soon to be old) method is to put almost everything in main.c and include various reused code via #include "kirk_utils.h" (good) and #include "motors.c" (not so good). Old hats will know the pits that I have fallen into this way. Not a big deal in small projects, but a real tangle can result as projects grow.
Please make suggestions, point out good examples and/or suggest some reading and tutorials to help me make the transition to better code practice.
Some specific questions and issues that I am having.
Should I to explicitly include motors.h in motors.c?
Global variables defined in main are generate errors in other .c files. What is a good practice to fix this? Should I make a global.h with various #defines #includes and global vars? (Then add #include global.h to everything?)