先来看一个没错的程序:
#include <iostream>
using namespace std;
struct Rectangle
{
int width;
int height;
};
int main()
{
Rectangle rect;
return 0;
}
加上#include<windows.h>就有错:
#include <windows.h>
#include <iostream>
using namespace std;
struct Rectangle
{
int width;
int height;
};
int main()
{
Rectangle rect;
return 0;
}
原来的程序很大, 我通过不断缩减的方法才定位到, 是Rectangle出了问题, 原因是Windows早已有了。 可以改为正确程序如下:
#include <windows.h>
#include <iostream>
using namespace std;
struct xxxRectangle
{
int width;
int height;
};
int main()
{
xxxRectangle rect;
return 0;
}