- UID
- 682354
- 积分
- 92
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2013-7-16
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
这个问题 有些纠结 各位有没有试过啊!
这是新建的类的源码- #pragma once
- #include "StdAfx.h"
- class Myclass
- {
- public:
- Myclass(void);
- ~Myclass(void);
- public:
- static AcDbObjectId creatline();
- };
- AcDbObjectId Myclass::creatline()
- {
- AcGePoint3d ptStart(0,0,0);
- AcGePoint3d ptEnd(100,100,0);
- AcDbLine *pLine=new AcDbLine(ptStart,ptEnd);
- //获取块表
- AcDbBlockTable *pBloTbl;
- acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBloTbl,AcDb::kForRead);
- //获取块表记录
- AcDbBlockTableRecord *pBloTblRcd;
- pBloTbl->getAt(ACDB_MODEL_SPACE,pBloTblRcd,kForWrite);
- AcDbObjectId entId;
- pBloTblRcd->appendAcDbEntity(entId,pLine);
- pBloTbl->close();
- pBloTblRcd->close();
- pLine->close();
- return entId;
- }
复制代码 入口点文件中代码如下:- // (C) Copyright 2002-2007 by Autodesk, Inc.
- //
- // Permission to use, copy, modify, and distribute this software in
- // object code form for any purpose and without fee is hereby granted,
- // provided that the above copyright notice appears in all copies and
- // that both that copyright notice and the limited warranty and
- // restricted rights notice below appear in all supporting
- // documentation.
- //
- // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
- // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
- // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
- // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
- // UNINTERRUPTED OR ERROR FREE.
- //
- // Use, duplication, or disclosure by the U.S. Government is subject to
- // restrictions set forth in FAR 52.227-19 (Commercial Computer
- // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
- // (Rights in Technical Data and Computer Software), as applicable.
- //
- //-----------------------------------------------------------------------------
- //----- acrxEntryPoint.cpp
- //-----------------------------------------------------------------------------
- #include "StdAfx.h"
- #include "resource.h"
- #include "Myclass.h"
- //-----------------------------------------------------------------------------
- #define szRDS _RXST("YS")
- //-----------------------------------------------------------------------------
- //----- ObjectARX EntryPoint
- class CArxProject3App : public AcRxArxApp {
- public:
- CArxProject3App () : AcRxArxApp () {}
- virtual AcRx::AppRetCode On_kInitAppMsg (void *pkt) {
- // TODO: Load dependencies here
- // You *must* call On_kInitAppMsg here
- AcRx::AppRetCode retCode =AcRxArxApp::On_kInitAppMsg (pkt) ;
-
- // TODO: Add your initialization code here
- return (retCode) ;
- }
- virtual AcRx::AppRetCode On_kUnloadAppMsg (void *pkt) {
- // TODO: Add your code here
- // You *must* call On_kUnloadAppMsg here
- AcRx::AppRetCode retCode =AcRxArxApp::On_kUnloadAppMsg (pkt) ;
- // TODO: Unload dependencies here
- return (retCode) ;
- }
- virtual void RegisterServerComponents () {
- }
- // - YSArxProject3._MyCommand1 command (do not rename)
- static void YSArxProject3_MyCommand1(void)
- {
- // Add your code for command YSArxProject3._MyCommand1 here
- Myclass::creatline();
- }
- } ;
- //-----------------------------------------------------------------------------
- IMPLEMENT_ARX_ENTRYPOINT(CArxProject3App)
- ACED_ARXCOMMAND_ENTRY_AUTO(CArxProject3App, YSArxProject3, _MyCommand1, MyCommand1, ACRX_CMD_TRANSPARENT, NULL)
复制代码 报错消息如下:
错误 1 error LNK2005: "public: static class AcDbObjectId __cdecl Myclass::creatline(void)" (?creatline@Myclass@@SA?AVAcDbObjectId@@XZ) 已经在 acrxEntryPoint.obj 中定义 Myclass.obj ArxProject3
错误 2 fatal error LNK1169: 找到一个或多个多重定义的符号 E:\VS_CAD\ArxProject3\Win32\Debug/YSArxProject3.arx ArxProject3
|
|