Error c2951: template declaration can only be used at the global, namespace, or class scope. Error c2598: link specification must be at the global scope Check where you put more or less parentheses in your code, especially if, else statements, right