我有以下代码中的问题:为什么Visual C++更改我的方法的名称?
class MainWindow
{
...
private:
bool CreateWindow(std::string, int, int, int, bool);
...
}
和
bool MainWindow::CreateWindow(std::string title, int width, int height,
int bits, bool fullscreen)
{
...
Visual Studio中突出,下面的错误的方法的定义:
int reateWindow(std::string title, int width, int height, int bits, bool fullscreen)
Error: class "MainWindow" has no member called "CreateWindowExW"
和编译器输出以下:
warning C4003: not enough actual parameters for macro 'CreateWindowW'
error C2039: 'CreateWindowExW' : is not a member of 'MainWindow'
我注意到,如果我将方法名称更改为其他名称,那不是以大写字母C开头,则错误消失。我是Windows开发新手。是什么赋予了?
TL; DR:因为有一个名称相同的宏。 –
愚蠢的Windows宏。 – Xeo
尽量避免Windows已经使用它的类和函数名称,以防止其他预处理器替换和链接问题。 – alexbuisson