CastSpell related API are protected, meaning you shouldn't be able to use them, only Blizzards code may use these functions. There are some few exceptions to this, but in general it would be better to go about this issue in a different way, namely using the secure template system.
To get you started:
http://wow.gamepedia.com/SecureActionButtonTemplate