Compiler Error C2771

#import only permitted at global or namespace scope

The #import preprocessor directive is only allowed in the global or namespace scope. It is not allowed in, for example, a function or structure scope.