我用动态链接库把cximage编译的.lib .dll文件加载到工程目录下后,Link也加了.lib文件,
程序可以顺利编译,但在链接时出现了以下错误,请问是怎么回事啊???好像是定义冲突了啊。
Linking...
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _fclose already defined in LIBCD.lib(fclose.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _calloc already defined in LIBCD.lib(dbgheap.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _free already defined in LIBCD.lib(dbgheap.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _sprintf already defined in LIBCD.lib(sprintf.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _malloc already defined in LIBCD.lib(dbgheap.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _fflush already defined in LIBCD.lib(fflush.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _realloc already defined in LIBCD.lib(dbgheap.obj)
MSVCRT.lib(MSVCRT.dll) : warning LNK4006: _fclose already defined in LIBCD.lib(fclose.obj); second definition ignored
MSVCRT.lib(MSVCRT.dll) : warning LNK4006: _calloc already defined in LIBCD.lib(dbgheap.obj); second definition ignored
MSVCRT.lib(MSVCRT.dll) : warning LNK4006: _free already defined in LIBCD.lib(dbgheap.obj); second definition ignored
MSVCRT.lib(MSVCRT.dll) : warning LNK4006: _sprintf already defined in LIBCD.lib(sprintf.obj); second definition ignored
MSVCRT.lib(MSVCRT.dll) : warning LNK4006: _malloc already defined in LIBCD.lib(dbgheap.obj); second definition ignored
MSVCRT.lib(MSVCRT.dll) : warning LNK4006: _fflush already defined in LIBCD.lib(fflush.obj); second definition ignored
MSVCRT.lib(MSVCRT.dll) : warning LNK4006: _realloc already defined in LIBCD.lib(dbgheap.obj); second definition ignored
   Creating library Debug/WinMain.lib and object Debug/WinMain.exp
LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "MSVCRTD" conflicts with use of other libs; use /NODEFAULTLIB:library
Debug/WinMain.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

解决方案 »

  1.   

    在项目配置 -》链接-》输入 -》忽略库里面 加上 MSVCRT.lib, MSVCRTD.lib
      

  2.   

    保持ximage和你的工程设置“代码生成”\“运行时库” 一致性
    Debug -> /MDd
    Release -> /MD
      

  3.   

    我按Enigma_CN 的方法做了,却又出现了如下问题,请问是怎么回事啊???Linking...
       Creating library Debug/WinMain.lib and object Debug/WinMain.exp
    WinMain.obj : error LNK2001: unresolved external symbol "public: int __thiscall CxImage::Destroy(void)" (?Destroy@CxImage@@QAEHXZ)
    Debug/WinMain.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.WinMain.exe - 2 error(s), 0 warning(s)
      

  4.   

     Debug -> /MDd 是什么意思啊???multithread DLL ???