1>------ 已啟動生成: 項目: gamep, 配置: Debug Win32 ------1>main.obj : error LNK2019: 無法解析的外部符號 "public: __thiscall skill::skill(void)" (??0skill@@QAE@XZ),該符號在函數(shù) "public: __thiscall role::role(int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int,int,int,int,int,int,int,int,int,int,class weapon * const,class medicine * const,class skill * const)" (??0role@@QAE@HV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HHHHHHHHHHQAVweapon@@QAVmedicine@@QAVskill@@@Z) 中被引用1>main.obj : error LNK2019: 無法解析的外部符號 "public: __thiscall medicine::medicine(void)" (??0medicine@@QAE@XZ),該符號在函數(shù) "public: __thiscall role::role(int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int,int,int,int,int,int,int,int,int,int,class weapon * const,class medicine * const,class skill * const)" (??0role@@QAE@HV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HHHHHHHHHHQAVweapon@@QAVmedicine@@QAVskill@@@Z) 中被引用1>main.obj : error LNK2019: 無法解析的外部符號 "public: __thiscall weapon::weapon(void)" (??0weapon@@QAE@XZ),該符號在函數(shù) "public: __thiscall role::role(int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int,int,int,int,int,int,int,int,int,int,class weapon * const,class medicine * const,class skill * const)" (??0role@@QAE@HV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HHHHHHHHHHQAVweapon@@QAVmedicine@@QAVskill@@@Z) 中被引用1>C:\Users\ThinkPad\Desktop\gamep\Debug\gamep.exe : fatal error LNK1120: 3 個無法解析的外部命令========== 生成: 成功 0 個,失敗 1 個,最新 0 個,跳過 0 個 ==========
2 回答

湖上湖
TA貢獻2003條經(jīng)驗 獲得超2個贊
出現(xiàn) error LNK2019: 無法解析的外部符號,是你聲明了函數(shù),但是沒有定義(實現(xiàn))函數(shù)。
如:
void function();
但是后面內(nèi)有具體定義這個函數(shù),即沒有函數(shù)體,link 程序連接時就產(chǎn)生這個錯誤。

慕慕森
TA貢獻1856條經(jīng)驗 獲得超17個贊
skill(void) weapon::weapon(void) medicine::medicine 這幾個函數(shù)在的源文件沒引入這個工程吧,或者頭文件里有,沒有實現(xiàn)
- 2 回答
- 0 關注
- 149 瀏覽
添加回答
舉報
0/150
提交
取消