使用Insure编译代码出现Warning: unable to instrument “xxx.cpp” (4) compiling original source code
使用Insre工具做代码的内存泄露检查,编译代码时发现提示 Warning: unable to instrument “xxx.cpp” (4) compiling original source code,没有能正常插桩, 对代码逐步分析排除问题后,发现是代码中使用了 jsoncpp 库,Insure编译时对jsoncpp的头文件没有能处理好,只要引用到了json.h的代码文件,都出现了 Warning: unable to instrument 的提示。
逐个尝试修改jsoncpp的头文件做分析,最后发现只要修改jsoncpp的 value.h 文件,
将 class JSON_API value 类下面
private: #ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION # ifndef JSON_VALUE_USE_INTERNAL_MAP class CZString {
的private:修改为public:变为
public: #ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION # ifndef JSON_VALUE_USE_INTERNAL_MAP class CZString {
后,重新使用Insure编译,正常插桩,编译通过,未再提示 warning: unable to instrument 错误。
Popularity: 9% [?]