VC/MFC 使用jsoncpp步骤及注意的问题

来源:互联网 发布:大数据架构详解 编辑:程序博客网 时间:2024/05/16 11:28

本文介绍使用VS2013如何配置jsoncpp步骤和使用过程中避免可能产生的问题

步骤:
1. 下载jsoncpp-src(下载链接:http://download.csdn.net/detail/chenmohpu/9799860)。
2. 解压jsoncpp-src-0.6.0到任意目录,进入jsoncpp-src-0.6.0-rc2\makefiles\vs71目录,在编译的过程中一定要记住选好的运行库,如图一所示。

这里写图片描述
图一
3. 进入jsoncpp-src-0.6.0-rc2\build\vs71\debug\lib_json目录会看到一个json_vc71_libmtd.lib文件(名字可以随便修改,我修改为json.lib)。
4. 拷贝json_vc71_libmtd.lib和jsoncpp-src-0.6.0-rc2\include\json目录及里面的所有头文件至自己的工程目录中,如图二所示。
这里写图片描述
图二
5. 添加json目录下的所有文件至自己的工程中,并包含json.lib库文件。
6. 编译自己的项目,一定要记住将项目的运行库和json.lib运行库设置成一致,如若不一致,将会产生大量的错误,如下所示。当项目必须选择特定的运行库时,可以回到步骤2,设置 工程->属性->配置属性->C/C++->代码生成->运行库与项目保持一致,重新编译生成*.lib包含进项目。

错误 142 error LNK1169: 找到一个或多个多重定义的符号 C:\Users\bosh_hu\OneDrive\Project_Temp\DTPS4\connect\PluginManager\PluginTest\Debug\PluginTest.exe PluginTest
错误 99 error LNK2005: “bool __cdecl std::uncaught_exception(void)” (?uncaught_exception@std@@YA_NXZ) 已经在 libcpmtd.lib(uncaught.obj) 中定义 C:\Users\bosh_hu\OneDrive\Project_Temp\DTPS4\connect\PluginManager\PluginTest\msvcprtd.lib(MSVCP120D.dll) PluginTest
错误 93 error LNK2005: “char const * __cdecl std::_Syserror_map(int)” (?_Syserror_map@std@@YAPBDH@Z) 已经在 libcpmtd.lib(syserror.obj) 中定义 C:\Users\bosh_hu\OneDrive\Project_Temp\DTPS4\connect\PluginManager\PluginTest\msvcprtd.lib(MSVCP120D.dll) PluginTest
错误 94 error LNK2005: “char const * __cdecl std::_Winerror_map(int)” (?_Winerror_map@std@@YAPBDH@Z) 已经在 libcpmtd.lib(syserror.obj) 中定义 C:\Users\bosh_hu\OneDrive\Project_Temp\DTPS4\connect\PluginManager\PluginTest\msvcprtd.lib(MSVCP120D.dll) PluginTest
错误 139 error LNK2005: “private: __thiscall type_info::type_info(class type_info const &)” (??0type_info@@AAE@ABV0@@Z) 已经在 LIBCMTD.lib(typinfo.obj) 中定义 C:\Users\bosh_hu\OneDrive\Project_Temp\DTPS4\connect\PluginManager\PluginTest\MSVCRTD.lib(ti_inst.obj) PluginTest
错误 140 error LNK2005: “private: class type_info & __thiscall type_info::operator=(class type_info const &)” (??4type_info@@AAEAAV0@ABV0@@Z) 已经在 LIBCMTD.lib(typinfo.obj) 中定义 C:\Users\bosh_hu\OneDrive\Project_Temp\DTPS4\connect\PluginManager\PluginTest\MSVCRTD.lib(ti_inst.obj) PluginTest
错误 121 error LNK2005: “protected: __thiscall std::basic_ios

0 0
原创粉丝点击