關於虛擬繼承
如題,請問一下,這是我的作業的一部份
MbusAsciiMasterProtocol: public MbusSerialMasterProtocol{
public:
MbusAsciiMasterProtocol();
virtual int openProtocol(const char * const portName,
long baudRate,
int dataBits,
int stopBits,
int parity);
virtual int openProtocol(const char * const portName, long baudRate);
...以下略
}
如上,當我要丟參數進去的時候
char *portName = "COM1";
int result = mbusProtocol.openProtocol(portName,
9600L,
8,
2,
0);
都會顯示錯誤,寫說無法解析的外部符號,目前想應該是這一行的型態出了問題
請問我該怎麼修改,以及可以說明一下原因嗎
因為將這一行註解掉時它只顯示說portname未宣告,錯誤訊息如下,謝謝
1>main.obj : error LNK2019: 無法解析的外部符號 "public: virtual __thiscall
MbusMasterFunctions::~MbusMasterFunctions(void)"
(??1MbusMasterFunctions@@UAE@XZ) 在函式 "public: virtual __thiscall
MbusSerialMasterProtocol::~MbusSerialMasterProtocol(void)"
(??1MbusSerialMasterProtocol@@UAE@XZ) 中被參考
1>main.obj : error LNK2019: 無法解析的外部符號 "public: __thiscall
SerialPort::~SerialPort(void)" (??1SerialPort@@QAE@XZ) 在函式 "public:
virtual __thiscall MbusSerialMasterProtocol::~MbusSerialMasterProtocol(void)"
(??1MbusSerialMasterProtocol@@UAE@XZ) 中被參考
1>main.obj : error LNK2019: 無法解析的外部符號 _getBusProtocolErrorText@4 在函
式 "void __cdecl openProtocol(void)" (?openProtocol@@YAXXZ) 中被參考
1>main.obj : error LNK2019: 無法解析的外部符號 "public: virtual int
__thiscall MbusAsciiMasterProtocol::openProtocol(char const *
const,long,int,int,int)"
(?openProtocol@MbusAsciiMasterProtocol@@UAEHQBDJHHH@Z) 在函式 "void __cdecl
openProtocol(void)" (?openProtocol@@YAXXZ) 中被參考
1>main.obj : error LNK2019: 無法解析的外部符號 "public: __thiscall
MbusAsciiMasterProtocol::MbusAsciiMasterProtocol(void)"
(??0MbusAsciiMasterProtocol@@QAE@XZ) 在函式 "void __cdecl openProtocol(void)"
(?openProtocol@@YAXXZ) 中被參考
1>D:\一般的C++程式碼\工廠網路系統\modbus\Debug\modbus.exe : fatal error
LNK1120: 5 個無法解析的外部符號
1
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 163.18.48.28
推
05/15 20:35, , 1F
05/15 20:35, 1F
→
05/15 20:55, , 2F
05/15 20:55, 2F
→
05/15 20:55, , 3F
05/15 20:55, 3F
推
05/15 22:14, , 4F
05/15 22:14, 4F
→
05/15 22:14, , 5F
05/15 22:14, 5F
→
05/16 11:20, , 6F
05/16 11:20, 6F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章