Cleanup code by using forward declarations and other methods of avoiding unnecesary header includes

Fix build error, cleanup CSecret artifact, and change main.h include to core.h
Remove cstdio references, depend on util.h instead.
Replace manual typedefs with stdint.h, replace PRI64[xdu] with PRI[xdu]64 from inttypes.h

Fix build problem hopefully.
Minor modifications after rebase.