0

I have this bit of code I'm trying to execute only once. but I seem to get this error every time I try to compile: "calcOppervlakte' was not declared in this scope" when it's being called in the setup.

I've looked at code examples where calling functions like this works, and I cannot wrap my head around this problem.

google isn't really helpful either since the search for something-something not declared in this scope gets me thousands of results.

double pi = 3.14159265359;

void setup() {
  Serial.begin(9600);
  for(int r = 1; r <11; r++){
    Serial.print(calcOppervlakte(r)); <----
  }
}

void loop() { 

}

double calcOpppervlakte(float radius){
  double result = pi * pow(radius, 2);
  return result;
}
4

The function name you're calling is calcOppervlakte but the function name in the definition is calcOpppervlakte. If you look closely you'll see there is an extra p in the function definition. If you change the names to match the error will be resolved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.