I commented out the extra mains please put main code outside of main.c in functions. Also Fixed a few errors. Please check compiler warnings too.