- UID
 - 468059
 
- 积分
 - 87
 
- 精华
 
- 贡献
 -  
 
- 威望
 -  
 
- 活跃度
 -  
 
- D豆
 -  
 
- 在线时间
 -  小时
 
- 注册时间
 - 2006-7-17
 
- 最后登录
 - 1970-1-1
 
 
 
 
 
 
 | 
 
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册 
 
 
 
 
×
 
我把一个在ObjectARX2002下的Hello程序,在VS2005下打开,经转换后,设置好属性页和选项页,并修改程序,然后编译,却出现以下错误: 
d:\vs2005练习\hello_2002\hello.cpp(13) : error C2664: “acutPrintf”: 不能将参数 1 从“const char [18]”转换为“const ACHAR *” 
        与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换 
d:\vs2005练习\hello_2002\hello.cpp(35) : error C2664: “AcEdCommandStack::addCommand”: 不能将参数 1 从“const char [20]”转换为“const ACHAR *” 
        与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换 
d:\vs2005练习\hello_2002\hello.cpp(42) : error C2664: “AcEdCommandStack::removeGroup”: 不能将参数 1 从“const char [20]”转换为“const ACHAR *” 
        与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换 
错误 
 
程序如下: 
 
#include "stdafx.h" 
#include "aced.h" 
#include "rxregsvc.h" 
#include "tchar.h" 
 
 
void initApp(); 
void unloadApp();  
void hello();  
 
void hello() 
{  
acutPrintf(_T("\nHello ObjectARX!")); 
 
} 
 
//初始化函 
void initApp() 
{ 
/* 
  //加载自定义菜单,STCAD.mns要放到AutoCAD2002/Support子目录下 
  char *fileName="STCAD.mns"; 
  char fullPath[100]; 
  if(!acedFindFile(fileName,fullPath)) 
  {return;} 
  ::acedCommand(RTSTR,"menu",RTSTR,fullPath,0); 
*/ 
 
//初始化函数 
// register a command with the AutoCAD command mechanism 
acedRegCmds->addCommand(_T("HELLOWORLD_COMMANDS"), 
                        _T("Hello"), 
                        _T("Hello"), 
                        ACRX_CMD_MODAL, 
                        hello); 
 
} 
 
//卸载函数 
static void unloadApp() 
{ 
        acedRegCmds->removeGroup(_T("HELLOWORLD_COMMANDS")); 
 
} 
 
 
//接口函数 
extern "C" AcRx::AppRetCode acrxEntryPoint( 
AcRx::AppMsgCode msg, void* appId) 
{ 
        switch( msg ) 
        { 
        case AcRx::kInitAppMsg: 
                acrxDynamicLinker->unlockApplication(appId); 
                acrxDynamicLinker->registerAppMDIAware(appId); 
                initApp(); 
                break; 
        case AcRx::kUnloadAppMsg: 
                unloadApp(); 
                break; 
        case AcRx::kInitDialogMsg: 
                break; 
        default: 
                break; 
        } 
        return AcRx::kRetOK; 
} |   
 
 
 
 |