svn switch fails because unversion files exist in the working copy, and the need to erase them comes up. This is also true when updating to an old revision (usually one that misses directories that exist in the head revision), doing some work (like compiling), and then trying to update back to the head revision. Subversion (SVN) will fail complaining that directories/files already exist.
The cause of the problem is that the working-copy isn’t clean, it has some (or a lot) of unversioned files. The best solution will be to delete all of them. While this can be a tedious task when done manually for each file, it can be achieved with single shell command.
svn status --no-ignore | grep '^\?' | sed 's/^\? //' svn status --no-ignore | grep '^\?' | sed 's/^\? //' | xargs -Ixx rm -rf xx
The first command will list all unversioned files and directories. Use this to review the files to be deleted. After you review the files, use the second command to delete them easily.
UPDATE 2010-12-29: Fixed the command, so it will handle spaces in filenames correctly.