博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
A Mysterious 'RuntimeLibrary' Link Error
阅读量:5054 次
发布时间:2019-06-12

本文共 1755 字,大约阅读时间需要 5 分钟。

I got a mysterious 'RuntimeLibrary' link error today.

 

We have a main executable project, and a few static library projects. The executable project links against to the static libraries. All the projects' runtime library setting were set to Multi-Thread (/MT). Everything goes well until we added a third party pre-compiled static link library.

 

When the library was added, we encountered many unresolved symbol error. I know many of you can't wait to tell me just change the runtime library setting. Yes that's what we did. As the library's document says it's compiled in /MD, We changed all the projects' setting to Multi-Thread DLL (/MD). However, we still encountered many unresolved symbol errors in VC++ runtime library, plus a mysterious error:

 

a.obj: error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MT_DynamicRelease' in b.obj

 

From the error message, we know that there must be something used /MT instead of /MD. But as I mentioned above, we changed every projects' setting to the same. We searched the internet to find out why, and found a post says they meet a problem very close to ours (). However, that's not our story.

 

After hours of digging into the SVN log, we found something interesting. At a very early stage of adding another project which produces a static link library, he / she changed EVERY cpp files' compile settings to use /MT, and changing the project's setting DOES NOT affact the source files' settings! Ay caramba! What the HELL was Microsoft thinking! Why would any one change a single cpp's runtime setting in ONE project?!

 

We changed all the source files' setting back to 'inherit from parent', and it worked like a charm.

 

转载于:https://www.cnblogs.com/wane/p/3373034.html

你可能感兴趣的文章
jQuery事件委托
查看>>
移动端元素拖拽事件
查看>>
HDOJ:1058
查看>>
swiper隐藏再显示出现点击不了情况
查看>>
js input radio点击事件
查看>>
okhttp post form表单
查看>>
STL中map的简单使用简介【转】
查看>>
【LOJ】#2057. 「TJOI / HEOI2016」游戏
查看>>
VC++编译说明
查看>>
Sitecore客户体验成熟度模型之旅
查看>>
浅析redis缓存 在spring中的配置 及其简单的使用
查看>>
SSL-ZYC 洛谷 P1118 数字三角形
查看>>
关于APNs的错误认识纠正
查看>>
InotifyPropertyChanged接口实现简单数据绑定
查看>>
text-align:center 在FireFox及Google浏览器下无效的问题
查看>>
BZOJ1692: [Usaco2007 Dec]队列变换
查看>>
《POINTERS ON C》(基于ANSI C)知识点及附带问题(三)
查看>>
leetcode dp
查看>>
简单回射程序小结
查看>>
iOS - 通过UIActivityViewController分享APP内容
查看>>