我的工程有一个 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.