You can, and should, do both. It really isn't a one-or-the-other situation.
Specialize in something, but keep up your general knowledge. Being too specialized is just as big a weakness as being too generalized. Unless, that is, you become the absolute best in the world at it. Which is not something you can plan for.
Also, don't pick a specialization just because you feel like you need one, or you'll always be behind the curve. If there's nothing you are passionate about to dive deeper and deeper into, keep looking.