The easy way to avoid it (or at least try to) IMO is to set the framework for the campaign beforehand. I mean, most of the "railroading" complaints I've seen is because there doesn't seem to be any real plot to the campaign; it's more like Law & Order (unrelated stories featuring the same cast) than 24 (related plots, each show adds another piece to the puzzle).
I personally like one large plot to the campaign, so I have made it a point from now on to inform the players of this before starting. This way, they know beforehand what type of character they should make, and thus it's not my fault if they ignore the campaign's theme. For example, if I make a campaign where Undead is the major theme, it's not my fault if a player makes a PC with maxed-out Sneak Attack and then is upset that it never works. They knew what the campaign would be, and chose to ignore it.
In short, it's not railroading when you hint to them it's going to happen. Now if my group just would ENJOY making characters that fit a theme, I'd be good to go!