编辑类时出错//Point.h#includestdafx.h#includeiostreamusing namespace stdclass Point{……}//Point
编辑类时出错
//Point.h
#include"stdafx.h"
#include<iostream>
using namespace std;
class Point{
……
}
//PointList.h
#include"stdafx.h"
#include"Point.h"
……
include "stdafx.h"
#include<iostream>
#include "Point.h"
#include "PointList.h"
?using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
……
? return 0;
}
报错:
?error C2011: “Point”: “class”类型重定义
所以想请各位帮忙看下,什么问题呢?
[解决办法]
在Point.h的最开始加上#pragma once
或者用
#ifndef _POINT_H
#define _POINT_H
class Point {
? ....
};
#endif
[解决办法]
