2010中codeguard的使用方法
昨天为了调试莫名其妙的内存问题,打开了codeguard的检测功能,结果搞了半天才搞好。
就把我的经验贡献出来吧
1.codeguard的启用
在2010中,tools->codeguard configuartion 将其enable了
2.project->options->c++ compiler->debugging ->enable codeguard设置为true
Rebuilde工程
至此,codeguard可以使用
2.codeguard的设置
我的代码中有如下:
if (!sscanf(buf, "%d", &actlen)) return false;
这本来是正常情况,sscanf如果没有读取到整数,就返回0,但是codeguard总是提示,说函数执行错误,我到codeguard configuartion ->funciton optios->sscanf函数,将function result errors的勾去掉,重建工程,但是还是报错。后来仔细查找资料,发现需要在codeguard configuartion 界面的file->open,选中自己的exe文件,然后再将function result errors的勾去掉,然后save,这样就不会报错了。
总之,在2010中,codeguard的设置需要多部,比6中要麻烦多了。。