Fix build on Debian with gcc 4.8.2

Just need to move these lines so that the headers which don't use the namespaces don't get confused by them.