A series of mono- and di-substituted quinazoline and pyrimidine derivatives based on the skeleton of erlotinib (an EGFR inhibitor) were synthesized and their bioactivities against hepatocellular carcinoma and human lung adenocarcinoma were evaluated.