In CNC machining, various errors, which caused by the cutting process and the structure of the machine tool, affect the machining accuracy of the machined parts. To analyze the relationship among the cutting force induced error, the thermal deformation, and the tool wear induced error, the empirical formula is employed in this study. The result shows that the cutting force is the main factor which affects the error distribution of the machined parts; the thermal deformation and the tool wear induced error change the error distribution. Furthermore, all the errors are coupling each other. To improve the accuracy of the machined parts, a pre-compensation method is proposed. To achieve the real-time error compensation, an application is designed to calculate the coupling error and to generate the NC code. Using the pre-compensation method, the maximum error is reduced from 0.015 mm to 0.002 mm. The error is compensated by 86.7% compared with no compensation.