Disclosed are compounds inhibiting ErbBs (e. g., EGFR or Her 2), especially mutant forms of ErbBs, and BTK, pharmaceutically acceptable salts, hydrates, solvates or stereoisomers thereof and pharmaceutical compositions comprising the compounds. The compound and the pharmaceutical composition can effectively treat ErbBs (especially mutant forms of ErbBs) or BTK associated diseases, including cancer.