I have recently using jsoncpp in my mfc project and it works fine.But when i trying to compiling the project with /clr and i got linker error below :
1>lib_json.lib(json_writer.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in Brusher.obj
1>lib_json.lib(json_value.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in Brusher.obj
1>lib_json.lib(json_reader.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in Brusher.obj
1>lib_json.lib(json_writer.obj) : error LNK2001: unresolved external symbol "__int64 const std::_BADOFF" (?_BADOFF@std@@3_JB)
1>lib_json.lib(json_writer.obj) : error LNK2001: unresolved external symbol "public: static class std::locale::id std::ctype::id" (?id@?$ctype@D@std@@2V0locale@2@A)
1>lib_json.lib(json_writer.obj) : error LNK2001: unresolved external symbol "private: static int std::locale::id::_Id_cnt" (?_Id_cnt@id@locale@std@@0HA)
How would I fix this?
i don't know how to mark a comment as a answer and here is the answer by @Hans Passant:
You cannot link a static library that was built with /MT. You must rebuild the library with /MD, rock-hard requirement for C++/CLI. – Hans Passant 11 hours ago
and what i did is rebuild the jsoncpp library with /MD and its working.