badboy518 发表于 2007-1-24 22:41:00

关于类定义的一点问题,都二天了,搞不定,帮帮我!

<p>新建了一个ARX工程,加入了两个文件,想定义一个类,代码如下:</p><p>//zzz.h<br/>#include "dbmain.h"<br/>class&nbsp; CbzqCLASS : public AcDbEntity<br/>{<br/>public:<br/>&nbsp;ACRX_DECLARE_MEMBERS(CbzqCLASS);</p><p>&nbsp;CbzqCLASS(void);<br/>&nbsp;virtual ~CbzqCLASS(void);<br/>&nbsp;<br/>&nbsp;&nbsp;&nbsp; virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* pFiler) const;<br/>&nbsp;virtual Acad::ErrorStatus dwgInFields(AcDbDwgFiler* pFiler);<br/>&nbsp;virtual Adesk::Boolean worldDraw(AcGiWorldDraw* mode);<br/>&nbsp;virtual Acad::ErrorStatus CbzqCLASS::explode(AcDbVoidPtrArray&amp; entitySet) const;<br/>&nbsp;virtual Acad::ErrorStatus CbzqCLASS::getGripPoints (AcGePoint3dArray &amp; gripPoints,AcDbIntArray&amp; osnapModes,AcDbIntArray&amp; geomIds) const;<br/>&nbsp;virtual Acad::ErrorStatus CbzqCLASS::moveGripPointsAt(const AcDbIntArray&amp; indices,const AcGeVector3d&amp; offset);<br/>&nbsp;virtual Acad::ErrorStatus CbzqCLASS::transformBy(const AcGeMatrix3d&amp; xform);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //设置插入基点<br/>&nbsp;Acad::ErrorStatus setBasePt(const AcGePoint3d pt);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //取得插入基点<br/>&nbsp;Acad::ErrorStatus getBasePt(AcGePoint3d&amp; pt) const; </p><p>private:<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AcGePoint3d BasePt;//图形插入基点<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AcGePoint3d LeftPointH;//左侧后墙的点<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AcGePoint3d LeftPointQ;//左侧前墙的点<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AcGePoint3d RightPointH;//右侧后墙的点<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AcGePoint3d RightPointQ;//右侧前墙的点<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AcGePoint3d PMPointH;//平面后墙的点<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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/>&nbsp;BasePt.set(0.0,0.0,0.0);//init基点<br/>}<br/>CbzqCLASS::~CbzqCLASS()<br/>{<br/>&nbsp;;//<br/>}<br/>//指定基点<br/>Acad::ErrorStatus setBasePt(const AcGePoint3d pt)<br/>{<br/>&nbsp;assertWriteEnabled();<br/>&nbsp;BasePt = pt;<br/>&nbsp;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>注掉&nbsp;assertWriteEnabled();<br/>&nbsp;注掉 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>

sieben 发表于 2007-1-25 10:28:00

<p>这个派生类不是用向导生成的吧?最好用向导,好多东西啊!</p><p>从编译报告来看应该是缺少相应头文件吧?首先声明我也不太懂</p>

badboy518 发表于 2007-1-25 11:21:00

本帖最后由 作者 于 2007-1-25 11:41:13 编辑 <br /><br /> <p>谢谢2楼的,真的很感谢!已解决。</p><p>说一下解决的过程,怕新手和我一样,出同样的错误。</p><p>1.在类视图中用右键点项目工程名</p><p>2.选择 添加-&gt;类。。。</p><p>3.出现一个添加类的对话框,左边选objectARX,右边选custom object wizard</p><p>4.点下面的添加按纽。</p><p>5.出现一个 custom object .....in dbx..&nbsp; 对话框,选 是 按纽。</p><p>别的我就不说了,填一下基本就可以了。</p>
页: [1]
查看完整版本: 关于类定义的一点问题,都二天了,搞不定,帮帮我!