For the first approach you'll need to make sure you've imported the RedirectResponse first. You can do this by adding the following to the top of your script:
use \Symfony\Component\HttpFoundation\RedirectResponse;
If this still doesn't work then you may have autoloader problems.
For the second case I'm not sure how $app could be undedfined. As this will have been created when you called:
$app = new Silex\Application();