Compiling and Using JSONCPP on Visual Studio10 with Boost

徘徊边缘 提交于 2019-11-28 20:40:24

All of the errors are indicative of wrong C runtime settings with your builds. Make sure that all of your object files, libraries, etc are compiled with the same runtime setting, that is:

  • Multithreaded (/MT)
  • Multithreaded DLL (/MD)
  • Multithreaded Debug (/MTd)
  • Multithreaded Debug DLL (/MDd)

If this setting isn't the same for all the projects, you've violated the one definition rule (because each C runtime defines things differently) which would result in the behavior you're seeing.

My guess is that the JSONCPP library is being built assuming the static version of the standard library (/MT), while your code is using the Visual Studio default, which is the dynamically linked version (/MD).

You can change this setting from within Visual Studio by selecting the project properties for your project, going to C/C++ -> Code Generation, and changing the Runtime dropdown box.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!