I declared my numeric variables in my program then tried to write those same variables in a function where it adds up all the variables then spits out a total. I get kicked back an error that says that the variable was not declared in this scope
Code:
g++ datos.cpp -o program.exe
datos.cpp:8:16: error: variable or field ‘totalCalc’ declared void
datos.cpp:8:16: error: ‘pago1’ was not declared in this scope
datos.cpp:8:23: error: ‘pago2’ was not declared in this scope
datos.cpp:8:30: error: ‘pago3’ was not declared in this scope
datos.cpp:8:37: error: ‘pago4’ was not declared in this scope
datos.cpp:8:45: error: ‘total’ was not declared in this scope
datos.cpp: In function ‘int main()’:
datos.cpp:42:47: error: ‘totalCalc’ was not declared in this scope
datos.cpp: At global scope:
datos.cpp:54:16: error: variable or field ‘totalCalc’ declared void
datos.cpp:54:16: error: ‘pago1’ was not declared in this scope
datos.cpp:54:23: error: ‘pago2’ was not declared in this scope
datos.cpp:54:30: error: ‘pago3’ was not declared in this scope
datos.cpp:54:37: error: ‘pago4’ was not declared in this scope
datos.cpp:54:45: error: ‘total’ was not declared in this scope
make: *** [program.exe] Error 1
Why is this happening?
P.S I had written the prototype and call and function definition correctly.