加上#include<windows.h>后出现的奇葩错误

来源:互联网 发布:滴滴快车车主软件 编辑:程序博客网 时间:2024/05/22 00:13

       先来看一个没错的程序:

#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;}


0 0
原创粉丝点击