beyard

常用链接

统计

最新评论

[总结]用jsoncpp感想

我的工程有一个 EXE, 好几个 DLL, 其中一个 DLL 要解析JSON,故选择第三方jsoncpp
I spend whole night compiling the code and integrated to my  DLL but failed !!
Finally came out 2 solutions.

(a) DLL:  MDd
     MFC dll, dynamic dll, unicode
(b) lib_jSon: MTd
      Windows Lib, Static lib, multibyte.

==========================

Solution 1.   
       1. Change lib_json from MTd to MDd;
       2. import the static lib in cpp file of DLL, like
           #pragma comment(lib, "lib_json.lib")
           
 Solution 2.
      1. Change the static lib into dynamic dll
      2. in "Json_Value.cpp", "Json_Reader.cpp", "Json_Writer.cpp", the first line of file add
           #define JSON_DLL_BUILD 

       3 in the cpp file of DLL, add
           #define JSON_DLL // by LIUXY for dll
            #include "../../3rd_Party/jsoncpp-src-0.5.0/include/json/json.h

       4. in the project property of DLL, don't forget to add the "lib_json.lib" for import.

posted on 2015-01-09 00:31 阅读(206) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理