libcmt.lib和msvcrt.lib冲突,原因和解决方法

来源:互联网 发布:tushare 期货数据 编辑:程序博客网 时间:2024/05/17 01:40

libcmt.lib是windows环境下vc提供的静态运行时库(多线程);msvcrt.lib是动态运行时库。

原因

由于DLL(或EXE)工程设置的Runtime Library 和 它导入的其他(.lib)库的Runtime Library不同。

比如: 下面为Release版,其中Runtime Library和use of MFC 需要匹配(所以这两个内容的设置是两两对应的)

类型 我的DLL工程 需要调用的lib库的工程 结果 工程名 DShow_Graph Baseclasses —— use of MFC Use MFC in a static Library Use MFC in a static Library —— Runtime Library Multi_threaded(/MT) Multi_threaded(/MT) 不冲突 use of MFC Use MFC in a static Library Use MFC in a shared DLL —— Runtime Library Multi_threaded(/MT) Multi_threaded DLL(/MTd) 冲突 use of MFC Use MFC in a shared DLL Use MFC in a static Library —— Runtime Library Multi_threaded DLL(/MTd) Multi_threaded(/MT) 冲突 use of MFC Use MFC in a shared DLL Use MFC in a shared DLL —— Runtime Library Multi_threaded DLL(/MTd) Multi_threaded DLL(/MTd) 不冲突

如果是Debug版本,只需要将上面的设置改为debug下的对应设置后,对应起来理解就可以了


解决方法

  • 把在编译两个工程时,把两个运行库都改为统一的(都是(/MT)或都是(/MTd)),这样就能顺利编译通过了。
0 0