I compile my program using g++ 4.8.5, I find that when my program exits, it first deconstructs the static member variables of class A, and then deconstructs a global object of class A. This caused an error in my program. Could you tell me how can I avoid this problem?Upgrade compiler version?Modify my code? my code like this: class A{ static int var; ~A(); //A Destructor depended var }; int A::var; A obj; var deconstructs before obj