LIBCMTD.lib问题(在线等)

时间:2008-05-12 13:50:00   来源:论坛整理  作者:  编辑:chinaitzhe
程序中用到了多线程,
假如想强行链接,中VS2005中如何设置?

以下为运行错误:
------ Build started: Project: WINThread, Configuration: Debug Win32 ------
Linking...
tinyxmld.lib(tinystr.obj) : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _malloc already defined in LIBCMT.lib(malloc.obj)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: __heap_alloc already defined in LIBCMT.lib(malloc.obj)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _calloc already defined in LIBCMT.lib(calloc.obj)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _realloc already defined in LIBCMT.lib(realloc.obj)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: __recalloc already defined in LIBCMT.lib(realloc.obj)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _free already defined in LIBCMT.lib(free.obj)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: __msize already defined in LIBCMT.lib(msize.obj)
LIBCMTD.lib(malloc.obj) : error LNK2005: _V6_HeapAlloc already defined in LIBCMT.lib(malloc.obj)
LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already defined in LIBCMT.lib(dbghook.obj)
LIBCMTD.lib(sbheap.obj) : error LNK2005: __get_sbh_threshold already defined in LIBCMT.lib(sbheap.obj)
LIBCMTD.lib(sbheap.obj) : error LNK2005: __set_sbh_threshold already defined in LIBCMT.lib(sbheap.obj)
LIBCMTD.lib(sbheap.obj) : error LNK2005: __set_amblksiz already defined in LIBCMT.lib(sbheap.obj)
LIBCMTD.lib(sbheap.obj) : error LNK2005: __get_amblksiz already defined in LIBCMT.lib(sbheap.obj)
LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_heap_init already defined in LIBCMT.lib(sbheap.obj)
LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_find_block already defined in LIBCMT.lib(sbheap.obj)
LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_free_block already defined in LIBCMT.lib(sbheap.obj)
LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_alloc_block already defined in LIBCMT.lib(sbheap.obj)
LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_alloc_new_region already defined in LIBCMT.lib(sbheap.obj)
LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_alloc_new_group already defined in LIBCMT.lib(sbheap.obj)
LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_resize_block already defined in LIBCMT.lib(sbheap.obj)
LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_heapmin already defined in LIBCMT.lib(sbheap.obj)
LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_heap_check already defined in LIBCMT.lib(sbheap.obj)
LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_pHeaderDefer already defined in LIBCMT.lib(sbheap.obj)
LIBCMTD.lib(isctype.obj) : error LNK2005: __isctype_l already defined in LIBCMT.lib(isctype.obj)
LIBCMTD.lib(isctype.obj) : error LNK2005: __isctype already defined in LIBCMT.lib(isctype.obj)
LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
C:\Documents and Settings\neusoft\My Documents\Visual Studio 2005\Projects\WINThread\Debug\WINThread.exe : fatal error LNK1169: one or more multiply defined symbols found
Build log was saved at "file://c:\Documents and Settings\neusoft\My Documents\Visual Studio 2005\Projects\WINThread\WINThread\Debug\BuildLog.htm"
WINThread - 26 error(s), 2 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

网友回复:在工程属性设置里的Linker设置中把LIBCMT.lib设置为忽略试试。
网友回复:指定编译选项/MDd
并忽略LIBCMT.lib
网友回复:在你用到多线程的 .cpp 文件中加上一句:
#pragma comment(lib, "LIBCMT.LIB")

比如我的一个程序中使用的:
C/C code





Code highlighting produced by Actipro CodeHighlighter (freeware)

http://www.CodeHighlighter.com/



#include "D3Dapp.h"

#include <process.h>

#pragma comment(lib, "LIBCMT.LIB")



//后台绘图线程

void Paint(void * obj)

{

    C3Dapp * C3Dobj = (C3Dapp *)obj;



    C3Dobj->Render();

}



HRESULT C3Dapp ::InitSence()

{

    CUSTVERTEX *                pWriteData;



    if (FAILED(m_lpD3dDevice->CreateVertexBuffer(sizeof(CUSTVERTEX) * 3,

    .............




网友回复:在哪里指定编译选项/MDd ?
初用此IDE不熟,谢谢!

网友回复:右击工程--属性--配置属性--C/C --代码生成--运行时库--多线程调试(/MDd)
右击工程--属性--配置属性--链接器--输入--忽略特定库
关键字:LIBCMTD,lib,问题,

相关文章

文章评论

共有 0 位网友发表了评论 此处只显示部分留言 点击查看完整评论页面