为什么会出现无法识别的外部符号BUG?该怎么解决?

1>------ 已启动生成: 项目: gamep, 配置: Debug Win32 ------
1>main.obj : error LNK2019: 无法解析的外部符号 "public: __thiscall skill::skill(void)" (??0skill@@QAE@XZ),该符号在函数 "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),该符号在函数 "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),该符号在函数 "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 个 ==========

慕森王
浏览 90回答 2
2回答

湖上湖

出现 error LNK2019: 无法解析的外部符号,是你声明了函数,但是没有定义(实现)函数。如:void function();但是后面内有具体定义这个函数,即没有函数体,link 程序连接时就产生这个错误。

慕慕森

skill(void) weapon::weapon(void) medicine::medicine 这几个函数在的源文件没引入这个工程吧,或者头文件里有,没有实现
打开App,查看更多内容
随时随地看视频慕课网APP