| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 862 人关注过本帖
标题:error LNK2005该怎样解决呢?
只看楼主 加入收藏
找不到服务器
Rank: 4
等 级:贵宾
威 望:12
帖 子:2937
专家分:1
注 册:2006-8-29
结帖率:33.33%
收藏
 问题点数:0 回复次数:3 
error LNK2005该怎样解决呢?
RT
错误列表
mention.obj : error LNK2005: "public: __thiscall mention::mention(void)" (??0mention@@QAE@XZ) already defined in ceshi.obj
mention.obj : error LNK2005: "public: virtual __thiscall mention::~mention(void)" (??1mention@@UAE@XZ) already defined in ceshi.obj
mention.obj : error LNK2005: "public: int __thiscall mention::Create(void)" (?Create@mention@@QAEHXZ) already defined in ceshi.obj
Debug/ceshi.exe : fatal error LNK1169: one or more multiply defined symbols found
执行 link.exe 时出错.

代码:
ceshi.cpp
// ceshi.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "mention.cpp"
int main(int argc, char* argv[])
{
    printf("Hello World!\n");
    mention* men;
    men=NULL;
    men->Create();
    return 0;
}

mention.cpp
// mention.cpp: implementation of the mention class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "mention.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

mention::mention()
{

}

mention::~mention()
{

}
mention::Create()
{
    printf("123456");
}
搜索更多相关主题的帖子: already symbols public Create 
2008-01-13 14:55
linsua
Rank: 1
等 级:新手上路
帖 子:275
专家分:0
注 册:2008-1-2
收藏
得分:0 
#include "mention.cpp"
去掉这句

如果你对我的话感到再明白不过 那恐怕你是误解了我的意思
2008-01-13 15:48
linsua
Rank: 1
等 级:新手上路
帖 子:275
专家分:0
注 册:2008-1-2
收藏
得分:0 
原帖由 [bold][underline]linsua[/underline][/bold] 于 2008-1-13 15:48 发表 [url=http://bbs.][/url]
#include "mention.cpp"
去掉这句

#include "mention.h"
再加上这句

如果你对我的话感到再明白不过 那恐怕你是误解了我的意思
2008-01-13 15:58
找不到服务器
Rank: 4
等 级:贵宾
威 望:12
帖 子:2937
专家分:1
注 册:2006-8-29
收藏
得分:0 
谢了

史上点击数最高的贴
http://bbs.bccn.net/thread-146005-1-1.html
2008-01-13 20:29
快速回复:error LNK2005该怎样解决呢?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.023764 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved