天天看点

usb类调用失败解释

调用usb类的时候,出现下面这些错误

Linking…

usb.obj : error LNK2001: unresolved external symbol “public: virtual __thiscall LsComm::CComPort::~CComPort(void)” ([email protected]@@[email protected])

usb.obj : error LNK2001: unresolved external symbol “public: __thiscall LsComm::CComPort::CComPort(void)” ([email protected]@@[email protected])

usb.obj : error LNK2001: unresolved external symbol “public: unsigned long __thiscall LsComm::CComPort::Output(void *,unsigned long)” ([email protected]@LsComm@@[email protected])

usb.obj : error LNK2001: unresolved external symbol “public: bool __thiscall LsComm::CComPort::IsOpen(void)” ([email protected]@LsComm@@QAE_NXZ)

usb.obj : error LNK2001: unresolved external symbol “public: unsigned long __thiscall LsComm::CComPort::GetInput(void *,unsigned long,unsigned long)” ([email protected]@LsComm@@[email protected])

usb.obj : error LNK2001: unresolved external symbol “public: void __thiscall CSerialPort::SetDTR(void)” ([email protected]@@QAEXXZ)

usb.obj : error LNK2001: unresolved external symbol “public: void __thiscall CSerialPort::SetRTS(void)” ([email protected]@@QAEXXZ)

usb.obj : error LNK2001: unresolved external symbol “public: class CSerialPort * __thiscall LsComm::CComPort::GetSerialPort(void)” ([email protected]@LsComm@@QAEPAVCSerialPort@@XZ)

usb.obj : error LNK2001: unresolved external symbol “public: bool __thiscall LsComm::CComPort::Open(int,unsigned long,enum LsComm::CComPort::ReceiveMode,enum LsComm::CComPort::Parity,unsigned char,enum LsComm::CComPort::StopBits,enum LsComm::CComPor

t::FlowControl)” ([email protected]@LsComm@@QAE_NHK[email protected]@[email protected]@[email protected]@[email protected]@@Z)

usb.obj : error LNK2001: unresolved external symbol “public: void __thiscall LsComm::CComPort::Close(void)” ([email protected]@LsComm@@QAEXXZ)

Debug/CloudspeakerDownload.exe : fatal error LNK1120: 10 unresolved externals

Error executing link.exe

解决办法:这里面是一个类中调用另外一个类的函数,但类外一个类并没有添加到工程中来。但usb类又调用了其他类的头文件,所有不会报没有这个函数的错误,只会报无法解析的错误

继续阅读