I found the problem - it was because of the build target I had selected.
I had been building for Symbian Anna, but when I switched to building for Symbian S60 (which is the target I actually wanted to build for anyway), the project compiled successfully. Symbian Anna had been selected by default when creating the new project, that's why I was building for it instead of for S60.