In computer-numerical-controlled (CNC) machine tools, factors affecting machining precision mainly stem from the machine's own geometric errors and errors occurring during cutting due to thermal effects on its structure. Typically, thermal errors contribute to more than 70% of the total error. Hence, minimizing thermal errors in CNC machine tools is highly regarded. One significant and commonly used approach is the thermal error compensation (TEC) method. Although the TEC method has been extensively applied in both laboratory and industrial CNC machines, several challenges remain. For instance, the determination of optimal temperature characteristic points for various CNC machine tools requires improved methods, the mathematical models for predicting and compensating thermal errors are not sufficiently accurate, and there is poor compensation performance under varying cutting conditions. In this research, we focus on thermal error prediction and compensation technology for a CNC highspeed four-rail vertical machining center. Through actual cutting experiments, we measure temperatures at feature points on the machine and spindle deformation using various high-tech sensors. Subsequently, precise prediction and rapid compensation models for thermal errors are established using support vector regression and transfer function matrix methods, respectively. Finally, a TEC system based on a single-chip microprocessor is developed. In this system, we perform real-time TEC during actual machining by adjusting the machine's original point drift. Results from actual cutting experiments demonstrate that the developed TEC system can effectively reduce the target machine's thermal deformation from 110 mu m to within 10 mu m in real time.