grimgrom
grimgrom

Reputation: 780

Can not name my function CreateWindow

I can not create my own function called CreateWindow because there's already one defined in the win32 header. It's just that I can't even do that in my own namespace either. What's the issue really?

MyNamespace::MyOwnWindowClass * Bit::CreateWindow( )
{
// Code here.
}

Getting errors such as:

Error   5   error C2447: '{' : missing function header (old-style formal list?)
Error   2   error C2039: 'CreateWindowExW' : is not a member of 'MyNamespace'

Upvotes: 2

Views: 563

Answers (1)

huskerchad
huskerchad

Reputation: 1037

The problem is that MS used a #define (I believe to map the function based on whether you are building for narrow or wide string). You have three choices. First, don't use CreateWindow in a file that must include the relevant MS header. Or, you could #undef it (I wouldn't recommend this) before using your function. Finally, you could just rename yours.

Upvotes: 6

Related Questions