首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

请教下 高手 出现这样的异常是因为什么

2012-02-06 
请问下 高手 出现这样的错误是因为什么啊sutd.obj : error LNK2005: public: int __thiscall Score::scor

请问下 高手 出现这样的错误是因为什么啊
sutd.obj : error LNK2005: "public: int __thiscall Score::score(void)" (?score@Score@@QAEHXZ) already defined in score.obj
sutd.obj : error LNK2005: "public: void __thiscall Score::print(void)" (?print@Score@@QAEXXZ) already defined in score.obj
Debug/sutd.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

[解决办法]
重复定义了,搜索一下这个函数,肯定有什么地方定义过了已经
[解决办法]
在头文件里实现过了,在cpp里又实现了
[解决办法]
already defined in score.obj
你翻译下不就知道了么
然后仔细查看,是否重复定义了。
[解决办法]
理论上来说是重复定义,在头文件中加上#ifndef...#define...#endif

热点排行