【发布时间】:2014-01-19 11:45:12
【问题描述】:
我是编程新手,正在学习http://c.learncodethehardway.org/book/ex4.html 上的教程,该教程向您展示了如何安装 valgrind。我已经编译了应该显示内存泄漏的示例程序
#include <stdio.h>
/* Warning: This program is wrong on purpose. */
int main()
{
int age = 10;
int height;
printf("I am %d years old.\n");
printf("I am %d inches tall.\n", height);
return 0;
}
但是当我输入时
$ valgrind ./ex4
我收到消息
valgrind: tool 'memcheck' not installed (/usr/local/lib/valgrind/memcheck-amd64-darwin) (No such file or directory)
当我查看该目录时,没有 memcheck 文件。安装程序没有用吗?
【问题讨论】:
-
“安装程序没有工作吗?”看起来像。
-
是的,@alk 是对的。删除了最新版本 3.9.0 并安装了教程 3.6.1 中的版本,并且 memcheck 可以正常工作。谢谢