Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Visual C++ changing the name of my method?

I have a problem with the following code:

class MainWindow
{
...
private:
bool CreateWindow(std::string, int, int, int, bool);
...
}

and

bool MainWindow::CreateWindow(std::string title, int width, int height, 
int bits, bool fullscreen)
{
...

Visual Studio highlights the method definition with the following error:

int reateWindow(std::string title, int width, int height, int bits, bool fullscreen)
Error: class "MainWindow" has no member called "CreateWindowExW"

and the compiler outputs the following:

warning C4003: not enough actual parameters for macro 'CreateWindowW'
error C2039: 'CreateWindowExW' : is not a member of 'MainWindow'

I noticed that if I change the method name to something else, that does not begin with a capital C, the error goes away. I'm new to Windows development. What gives?

like image 445
Dan Nestor Avatar asked Jul 09 '13 09:07

Dan Nestor


1 Answers

It is simply because CreateWindow is a macro created by Microsoft... It is defined in WinUser.h.

like image 66
Pierre Fourgeaud Avatar answered Sep 24 '22 14:09

Pierre Fourgeaud