modify to compile function prototypes and definitions in defined order