Main.cc: In function 'int qiu_he(int, int)': Main.cc:4:2: error: 'sum' was not declared in this scope sum=0 ^ Main.cc:5:14: error: 'i' was not declared in this scope for(int i=a;i<=b;i++){ ^