找回密码
 用户注册

QQ登录

只需一步,快速开始

查看: 4444|回复: 3

5.7的静态库

[复制链接]
发表于 2010-7-13 01:02:41 | 显示全部楼层 |阅读模式
编译倒是通过了,写了个测试用的程序,提示一堆错误

1>------ 已启动生成: 项目: ACE_Static_Test, 配置: Debug Win32 ------
1>正在编译...
1>first.cpp
1>正在链接...
1>LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall std::exception::exception(void)" (??0exception@std@@QAE@XZ) 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall std::exception::exception(char const * const &)" (??0exception@std@@QAE@ABQBD@Z) 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall std::exception::exception(class std::exception const &)" (??0exception@std@@QAE@ABV01@@Z) 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: virtual __thiscall std::exception::~exception(void)" (??1exception@std@@UAE@XZ) 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ) 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: _malloc 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: _calloc 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: _realloc 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: _free 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __CrtSetDbgFlag 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __CrtSetCheckCount 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(setlocal.obj) : error LNK2005: __configthreadlocale 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(getenv.obj) : error LNK2005: _getenv 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(mlock.obj) : error LNK2005: __lock 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(mlock.obj) : error LNK2005: __unlock 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: _exit 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __exit 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __cexit 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __amsg_exit 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __initterm_e 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(dosmap.obj) : error LNK2005: __errno 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(_file.obj) : error LNK2005: ___iob_func 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(fflush.obj) : error LNK2005: _fflush 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(tidtable.obj) : error LNK2005: __encode_pointer 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(tidtable.obj) : error LNK2005: __decode_pointer 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(isctype.obj) : error LNK2005: __isctype 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(trnsctrl.obj) : error LNK2005: ___CxxFrameHandler3 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(typinfo.obj) : error LNK2005: "public: char const * __thiscall type_info::_name_internal_method(struct __type_info_node *)const " (?_name_internal_method@type_info@@QBEPBDPAU__type_info_node@@@Z) 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(typinfo.obj) : error LNK2005: "public: void __thiscall type_info::_type_info_dtor_internal_method(void)" (?_type_info_dtor_internal_method@type_info@@QAEXXZ) 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(typinfo.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) 已经在 MSVCRTD.lib(ti_inst.obj) 中定义
1>LIBCMTD.lib(typinfo.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) 已经在 MSVCRTD.lib(ti_inst.obj) 中定义
1>LIBCMTD.lib(strftime.obj) : error LNK2005: _strftime 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(fclose.obj) : error LNK2005: _fclose 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(crt0.obj) : error LNK2005: _mainCRTStartup 已经在 MSVCRTD.lib(crtexe.obj) 中定义
1>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_a 已经在 MSVCRTD.lib(cinitexe.obj) 中定义
1>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_z 已经在 MSVCRTD.lib(cinitexe.obj) 中定义
1>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_a 已经在 MSVCRTD.lib(cinitexe.obj) 中定义
1>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_z 已经在 MSVCRTD.lib(cinitexe.obj) 中定义
1>LIBCMTD.lib(winxfltr.obj) : error LNK2005: __XcptFilter 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(winsig.obj) : error LNK2005: _signal 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(winsig.obj) : error LNK2005: _raise 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(invarg.obj) : error LNK2005: __invalid_parameter 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(invarg.obj) : error LNK2005: __invoke_watson 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(vsprintf.obj) : error LNK2005: _vsprintf 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(typname.obj) : error LNK2005: ___clean_type_info_names_internal 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(tzset.obj) : error LNK2005: __tzset 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(stricmp.obj) : error LNK2005: __stricmp 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(errmode.obj) : error LNK2005: ___set_app_type 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(osfinfo.obj) : error LNK2005: __get_osfhandle 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(osfinfo.obj) : error LNK2005: __open_osfhandle 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(dbgrptw.obj) : error LNK2005: __CrtDbgReportW 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(vswprnc.obj) : error LNK2005: __vswprintf_c_l 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(tolower.obj) : error LNK2005: _tolower 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(strnicmp.obj) : error LNK2005: __strnicmp 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LIBCMTD.lib(vprintf.obj) : error LNK2005: _vprintf 已经在 MSVCRTD.lib(MSVCR80D.dll) 中定义
1>LINK : warning LNK4098: 默认库“MSVCRTD”与其他库的使用冲突;请使用 /NODEFAULTLIB:library
1>LINK : warning LNK4098: 默认库“LIBCMTD”与其他库的使用冲突;请使用 /NODEFAULTLIB:library
1>E:\vs2005_project_win7\ACE_Static_Test\Debug\ACE_Static_Test.exe : fatal error LNK1169: 找到一个或多个多重定义的符号
1>生成日志保存在“file://e:\vs2005_project_win7\ACE_Static_Test\ACE_Static_Test\Debug\BuildLog.htm”
1>ACE_Static_Test - 58 个错误,2 个警告
========== 生成: 0 已成功, 1 已失败, 0 最新, 0 已跳过 ==========


请问怎么改,有人遇到过吗?
发表于 2010-7-13 09:18:49 | 显示全部楼层
你的工程中,使用了不正确的运行库。在VC里面,有好几种,比如静态链接的、DLL的,查看C++选项。与你编译ACE的选项要对比一下,查看差异。
这种问题好解决。
 楼主| 发表于 2010-7-13 10:52:22 | 显示全部楼层
在项目设置里,将MDd改为MTd就可以了
呵呵
大概意思是静态与动态吧?
发表于 2010-7-13 11:12:26 | 显示全部楼层
对。就是是否使用外部的DLL。
您需要登录后才可以回帖 登录 | 用户注册

本版积分规则

Archiver|手机版|小黑屋|ACE Developer ( 京ICP备06055248号 )

GMT+8, 2024-5-22 17:54 , Processed in 0.021980 second(s), 6 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表