当前位置:编程学习 > C/C++ >>

C++代码哪里出错

#include <afxwin.h>

class CMyPoint : public CObject
{
public:
double x,y;
COLORREF c;
public:
CMyPoint();
CMyPoint( double srx, double sry, COLORREF src){
CMyPoint::x= srx;
CMyPoint::y= sry;
CMyPoint::c= src;
}
public:
double GetCMyPointX() {
return CMyPoint::x;
}
double GetCMyPointY() {
return CMyPoint::y;
}
COLORREF GetCMyPointC() {
return CMyPoint::c;
}
};

编译时:

Compiling...
CWin.cpp
f:\tpx\workout.h(3) : error C2011: 'CMyPoint' : 'class' type redefinition
执行 cl.exe 时出错.

TPX.exe - 1 error(s), 0 warning(s)

Why?

答案:

在文件前面添加

#pragma warning(disable:4146)
#import "C:\Program Files\Common Files\System\ADO\msado15.dll" named_guids rename("EOF","adoEOF"), rename("BOF","adoBOF")
#pragma warning(default:4146)
using namespace ADODB;

试试有没有效果?

上一个:用AJAX处理的数据都是放在客户端的么
下一个:c++代码 纳税问题

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,