阅读:1634回复:4
看看怎么办?
遇到一个问题,请高手解答!
源代码: //head file #include <vtoolscp.h> #define DEVICE_CLASS PortdevDevice #define PORTDEV_DeviceID UNDEFINED_DEVICE_ID #define PORTDEV_Init_Order UNDEFINED_INIT_ORDER #define PORTDEV_Major 1 #define PORTDEV_Minor 0 #define PORT_NUM 0xf0 class PortdevDevice : public VDevice { public: virtual BOOL OnSysDynamicDeviceInit(); virtual BOOL OnSysDynamicDeviceExit(); }; class PortdevVM : public VVirtualMachine { public: PortdevVM(VMHANDLE hVM); }; class PortdevThread : public VThread { public: PortdevThread(THREADHANDLE hThread); }; class mioportP:public VIOPort { public: mioportP():VIOPort(PORT_NUM){}; DWORD handler(VMHANDLE hVM,DWORD port,CLIENT_STRUCT * pRegs, DWORD iotype,DWORD outdata); }; //cpp file #define DEVICE_MAIN #include "portdev.h" Declare_Virtual_Device(PORTDEV) #undef DEVICE_MAIN mioportP* pio; PortdevVM::PortdevVM(VMHANDLE hVM) : VVirtualMachine(hVM) {} PortdevThread::PortdevThread(THREADHANDLE hThread) : VThread(hThread) {} BOOL PortdevDevice::OnSysDynamicDeviceInit() { pio=new(mioportP); if (pio) { if (pio->hook()) { dout<<"hook success"<<endl; } else { dout<<"hook unsuccess"<<endl; return FALSE; } } else { dout<<"Error new port"<<endl; return FALSE; } return TRUE; } BOOL PortdevDevice::OnSysDynamicDeviceExit() { if (pio) { if(pio->unhook()) { dout<<"unhook success"<<endl; } delete pio; } return TRUE; } DWORD handler(VMHANDLE hVM,DWORD port,CLIENT_STRUCT * pRegs, DWORD iotype,DWORD outdata) { static WORD count=0; static WORD buffer[10]; static BYTE inppt=0; count++; dout<<"entering handler"<<endl; dout<<"entered count:"<<count<<endl; switch(iotype) { case BYTE_INPUT: { dout<<"buffer byte"<<(BYTE)buffer[inppt]<<endl; inppt++; return (BYTE) buffer[inppt-1]; } case WORD_INPUT: { dout<<"buffer word"<<(WORD)buffer[inppt]<<endl; inppt++; return (WORD) buffer[inppt-1]; } case DWORD_INPUT: { dout<<"buffer dword"<<(DWORD)buffer[inppt]<<endl; inppt++; return (DWORD) buffer[inppt-1]; } case BYTE_OUTPUT: { buffer[count-1]=outdata; dout<<"byte output data :"<<(BYTE)outdata<<endl; break; } case WORD_OUTPUT: { buffer[count-1]=outdata; dout<<"word output data :"<<(WORD)outdata<<endl; break; } case DWORD_OUTPUT: { buffer[count-1]=outdata; dout<<"dword output data :"<<(DWORD)outdata<<endl; break; } default:break; } return 0; } //故障 portdev.OBJ : error LNK2001: unresolved external symbol "public: virtual unsigned long __thiscall mioportP::handler(struct cb_s *,unsigned long,union tagCLIENT_STRUC *,unsigned long,unsigned long)" (?handler@mioportP@@UAEKPAUcb_s@@KPATtagCLIENT_STRU C@@KK@Z) PORTDEV.VXD : fatal error LNK1120: 1 unresolved externals NMAKE : fatal error U1077: 'E:\PROGRA~1\MICROS~1\VC98\bin\link.exe' : return code '0x460' Stop. Error executing NMAKE. 请帮忙,谢谢啦 |
|
沙发#
发布于:2001-07-26 17:28
帮帮我吧?!为什么都是连接错误?或者你们曾经遇到吗?
|
|
板凳#
发布于:2001-07-29 19:52
老兄,类应该用两个冒号(::)吧? 你的怎么都是一个呢? |
|
地板#
发布于:2001-08-11 21:41
我以前用vtoolsd时,用的链接器是bc5的linker.exe,不会出错,但换用bcb的ilinker.exe(增量链接器)便出错,错误类型似乎与你的错误相同,vc6的linker.exe也是增量链接器,我想可能换一个非增量链接器,或许可以纠正.
|
|
地下室#
发布于:2001-08-30 18:40
在函数handler(VMHANDLE hVM,DWORD port,CLIENT_STRUCT * pRegs, DWORD iotype,DWORD outdata) 前面少了mioportP::,老雄
|
|
|