How can I cast a value in const Ref<InputEvent>& to InputEventMouseMotion when coding gdextension?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By bc

I want to get mouse input using c++. and here’s my context:
void CameraManualControl::_input(const Ref &event)
{
InputEventMouseMotion* mouse_event = dynamic_cast<InputEventMouseMotion*>(const_cast<InputEvent*>(event.ptr()));
if (mouse_event)
{…}
}
And I will the error C2027: Used undefined type “godot::InputEvent” at ref.hpp(258)
It means I cannot get InputEvent because of Ref don’t know about InputEventMouseMotion.
So How can I get mouse motion using c++?