Please Help! "addDescriptor" Example Error

I cannot get the following to compile from this link... https://www.arduino.cc/en/Reference/ArduinoBLEBLECharacteristicaddDescriptor

BLEUnsignedCharCharacteristic batteryLevelChar("2A19", BLERead | BLENotify);

BLEDescriptor batteryLevelDescriptor("2901", "millis");  

batteryLevelChar.addDescriptor(batteryLevelDescriptor);

It gives me this error: 'batteryLevelChar' does not name a type

Thank you, Gary.

Looking at the whole program may help.

What do you mean exactly? That's the example from the link I gave.

Edit: it's ok I figured it out, thank you.

So what was the problem, and how was it solved?

addDescriptor needed moving further down the page, lol.