编辑类时出错

晓枫gis 2012-03-23 12:39:19
//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”类型重定义


所以想请各位帮忙看下,什么问题呢?
...全文
80 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
quwei197874 2012-03-23
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 kevin_perkins 的回复:]
在Point.h的最开始加上#pragma once
或者用
#ifndef _POINT_H
#define _POINT_H
class Point {
....
};
#endif
[/Quote]++
漫步者、 2012-03-23
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 ganpengjin1 的回复:]
C/C++ code

class Point{
……
};//加个';'就行了
[/Quote]

#ifndef Point_H
#define Point_H
class Point{
……
};//加个';'就行了
#endif
漫步者、 2012-03-23
  • 打赏
  • 举报
回复

class Point{
……
};//加个';'就行了

Kevin_Perkins 2012-03-23
  • 打赏
  • 举报
回复
在Point.h的最开始加上#pragma once
或者用
#ifndef _POINT_H
#define _POINT_H
class Point {
....
};
#endif

65,187

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧