关于类定义的一点问题,都二天了,搞不定,帮帮我!
<p>新建了一个ARX工程,加入了两个文件,想定义一个类,代码如下:</p><p>//zzz.h<br/>#include "dbmain.h"<br/>class CbzqCLASS : public AcDbEntity<br/>{<br/>public:<br/> ACRX_DECLARE_MEMBERS(CbzqCLASS);</p><p> CbzqCLASS(void);<br/> virtual ~CbzqCLASS(void);<br/> <br/> virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* pFiler) const;<br/> virtual Acad::ErrorStatus dwgInFields(AcDbDwgFiler* pFiler);<br/> virtual Adesk::Boolean worldDraw(AcGiWorldDraw* mode);<br/> virtual Acad::ErrorStatus CbzqCLASS::explode(AcDbVoidPtrArray& entitySet) const;<br/> virtual Acad::ErrorStatus CbzqCLASS::getGripPoints (AcGePoint3dArray & gripPoints,AcDbIntArray& osnapModes,AcDbIntArray& geomIds) const;<br/> virtual Acad::ErrorStatus CbzqCLASS::moveGripPointsAt(const AcDbIntArray& indices,const AcGeVector3d& offset);<br/> virtual Acad::ErrorStatus CbzqCLASS::transformBy(const AcGeMatrix3d& xform);<br/> //设置插入基点<br/> Acad::ErrorStatus setBasePt(const AcGePoint3d pt);<br/> //取得插入基点<br/> Acad::ErrorStatus getBasePt(AcGePoint3d& pt) const; </p><p>private:<br/> <br/> AcGePoint3d BasePt;//图形插入基点<br/> AcGePoint3d LeftPointH;//左侧后墙的点<br/> AcGePoint3d LeftPointQ;//左侧前墙的点<br/> AcGePoint3d RightPointH;//右侧后墙的点<br/> AcGePoint3d RightPointQ;//右侧前墙的点<br/> AcGePoint3d PMPointH;//平面后墙的点<br/> AcGePoint3d PMPointQ;//平面前墙的点<br/>};</p><p>//zzz.cpp<br/>#include "stdafx.h"<br/>#include "zzz.h"<br/>#include "dbmain.h"</p><p>ACRX_DXF_DEFINE_MEMBERS(CbzqCLASS, AcDbEntity, 15, 0, AcDbProxyEntity::kColorChangeAllowed, ASDKACLINE, ASDKACLINE);</p><p>CbzqCLASS::CbzqCLASS()<br/>{<br/> BasePt.set(0.0,0.0,0.0);//init基点<br/>}<br/>CbzqCLASS::~CbzqCLASS()<br/>{<br/> ;//<br/>}<br/>//指定基点<br/>Acad::ErrorStatus setBasePt(const AcGePoint3d pt)<br/>{<br/> assertWriteEnabled();<br/> BasePt = pt;<br/> return Acad::eOk;<br/>}</p><p>正在编译...<br/>zzz.cpp<br/>c:\documents and settings\ab\my documents\visual studio 2005\projects\arxprojectrrrr\arxprojectrrrr\zzz.cpp(20) : error C3861: 'assertWriteEnabled': identifier not found<br/>c:\documents and settings\ab\my documents\visual studio 2005\projects\arxprojectrrrr\arxprojectrrrr\zzz.cpp(21) : error C2065: 'BasePt' : undeclared identifier<br/>生成日志保存在“file://c:\Documents and Settings\ab\My Documents\Visual Studio 2005\Projects\ArxProjectrrrr\ArxProjectrrrr\Debug\BuildLog.htm”<br/>ArxProjectrrrr - 2 个错误,0 个警告<br/>========== 生成: 0 已成功, 1 已失败, 0 最新, 0 已跳过 ==========</p><p>注掉 assertWriteEnabled();<br/> 注掉 BasePt = pt;</p><p>能通过编译又出错如下:</p><p>zzz.obj : error LNK2001: 无法解析的外部符号 "public: virtual int __thiscall CbzqCLASS::worldDraw(class AcGiWorldDraw *)" (<a href="mailto:?worldDraw@CbzqCLASS@@UAEHPAVAcGiWorldDraw@@@Z">?worldDraw@CbzqCLASS@@UAEHPAVAcGiWorldDraw@@@Z</a>)<br/>.....</p><p>....</p><p><br/>Debug/xxyArxProjectrrrr.arx : fatal error LNK1120: 7 个无法解析的外部命令</p><p>为什么啊?是不是类不能这样申明?还是别的什么问题?请指点一下,都二天了,还没搞好。</p> <p>这个派生类不是用向导生成的吧?最好用向导,好多东西啊!</p><p>从编译报告来看应该是缺少相应头文件吧?首先声明我也不太懂</p> 本帖最后由 作者 于 2007-1-25 11:41:13 编辑 <br /><br /> <p>谢谢2楼的,真的很感谢!已解决。</p><p>说一下解决的过程,怕新手和我一样,出同样的错误。</p><p>1.在类视图中用右键点项目工程名</p><p>2.选择 添加->类。。。</p><p>3.出现一个添加类的对话框,左边选objectARX,右边选custom object wizard</p><p>4.点下面的添加按纽。</p><p>5.出现一个 custom object .....in dbx.. 对话框,选 是 按纽。</p><p>别的我就不说了,填一下基本就可以了。</p>
页:
[1]