Theory of high-order harmonic generation from molecules by intense laser pulses