The problem is that
CreateWindow
has already been declared as a C Preprocessor macro in WinUser.h
...
#ifdef UNICODE
#define CreateWindow CreateWindowW
#else
#define CreateWindow CreateWindowA
#endif
...
and C Preprocessor macros being an old school C feature take no account of
namespace
s.
There are 2 ways to deal with this. Either use a different name, I use
mxCreateWindow
for historical reasons or get rid of the macro definition before the parser finds your function.
#undef CreateWindow
That might seem simple enough but if you also use the global namespace CreateWindowW or CreateWindowA functions by using the name CreateWindow that code could now be broken because you've take away the macro that defined part of it.
One way round this is to use
#pragma push_macro("CreateWindow")
before your code and
#pragma pop_macro("CreateWindow")
after your code but this is very Microsoft Visual C++ specific and may not even work reliably with all versions of that so consider carefully.