连接的时候出现错误,各位帮忙看看是怎么回事

lixiang1021 2004-04-20 02:24:04
按照C++ Primer上的例子,写了一段程序,如下:

#include <iostream>
#include <string>
using namespace std;

int main()
{
string word;
while ( cin >> word )
cout<<"Word read is:"<< word<<'\n';
cout<<"OK,No more words to read,Bye! ";
return 0;

}

然后VC中进行编译,连接的时候出现错误,提示:
LIBCMT.lib(osfinfo.obj) : error LNK2005: __alloc_osfhnd already defined in
LIBCD.lib(osfinfo.obj)
LIBCMT.lib(osfinfo.obj) : error LNK2005: __set_osfhnd already defined in
LIBCD.lib(osfinfo.obj)
LIBCMT.lib(osfinfo.obj) : error LNK2005: __free_osfhnd already defined in
LIBCD.lib(osfinfo.obj)
LIBCMT.lib(osfinfo.obj) : error LNK2005: __get_osfhandle already defined in
LIBCD.lib(osfinfo.obj)
LIBCMT.lib(osfinfo.obj) : error LNK2005: __open_osfhandle already defined in
LIBCD.lib(osfinfo.obj)
LIBCMT.lib(dosmap.obj) : error LNK2005: __dosmaperr already defined in
LIBCD.lib(dosmap.obj)
...全文
55 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
lixiang1021 2004-04-20
  • 打赏
  • 举报
回复
已经搞定了,谢谢
thinkingsheep 2004-04-20
  • 打赏
  • 举报
回复
程序没问题啊!
Linker Tools Error LNK2005
symbol already defined in object

The given symbol, displayed in its decorated form, was multiply defined.

Tips

One of the following may be a cause:

The most common cause of this error is accidentally linking with both the single-threaded and multithreaded libraries. Ensure that the application project file includes only the appropriate libraries and that any third-party libraries have appropriately created single-threaded or multithreaded versions.


The given symbol was a packaged function (created by compiling with /Gy) and was included in more than one file but was changed between compilations. Recompile all files that include the symbol.


The given symbol was defined differently in two member objects in different libraries, and both member objects were used.


An absolute was defined twice, with a different value in each definition.

65,210

社区成员

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

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