#include 后 出现的错误!!!

GoForSky 2010-04-22 07:33:42

#include <iostream.h>
#include <afxwin.h>


void main()
{
cout<<"good"<<endl;
}


nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in libcpmtd.lib(delop.obj)
LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library
Debug/kkkkk.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.



好好的一个程序,加上#include <afxwin.h>后,
出现这么多错误,太迷糊了
...全文
426 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
wusss 2010-05-18
  • 打赏
  • 举报
回复
不懂 学习
GoForSky 2010-04-22
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 cattycat 的回复:]
用#include <iostream>
using namespace std;
如果还出错,要在project的settings里选择使用MFC库静态或共享方式。
[/Quote]

为什么静态库连接不行呢
GoForSky 2010-04-22
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 wade_2003 的回复:]
C/C++ code

#include <iostream>
#include <afxwin.h>


int main()
{
std::cout<<"good"<<std::endl;
return 0;
}



编译还是不行,在设置里设置为使用MFC作为共享的DLL,就搞定了。
[/Quote]

静态都不行,只有共享的DLL
wade_2003 2010-04-22
  • 打赏
  • 举报
回复

#include <iostream>
#include <afxwin.h>


int main()
{
std::cout<<"good"<<std::endl;
return 0;
}


编译还是不行,在设置里设置为使用MFC作为共享的DLL,就搞定了。
cattycat 2010-04-22
  • 打赏
  • 举报
回复
用#include <iostream>
using namespace std;
如果还出错,要在project的settings里选择使用MFC库静态或共享方式。
dskit 2010-04-22
  • 打赏
  • 举报
回复

#include <iostream>
#include <afxwin.h>


int main()
{
std::cout<<"good"<<std::endl;
return 0;
}




64,643

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧