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.本申請公開了抑制ErbB(例如EGFR或Her2),尤其是ErbB的突變形式以及BTK的化合物,其藥學上可接受的鹽、水合物、溶劑化物或立體異構體,以及包含所述化合物的藥物組合物。所述化合物和所述藥物組合物可以有效地治療ErbB(特別是ErbB的突變形式)或BTK相關疾病,包括癌症。