|
|
|
|
| 高手指点:dmalloc库 使用gcc 和 cc 来编译连接,结果不同? |
 高手指点:dmalloc库 使用gcc 和 cc 来编译连接,结果不同? - tclwp [ 2005-08-30 21:32 | 2,678 byte(s)]
 Re: 高手指点:dmalloc库 使用gcc 和 cc 来编译连接,结果不同? - zhllg [ 2005-08-30 22:49 | 44 byte(s)]
 Re: 高手指点:dmalloc库 使用gcc 和 cc 来编译连接,结果不同? - tclwp [ 2005-08-30 22:43 | 76 byte(s)]
|
|
|
|
[Original]
[Print]
[Top]
|
先在test.c 所有include文件的最下面加上:
#ifdef DMALLOC
#include <dmalloc.h>
#endif
保存
#ls -l `which cc`
/usr/bin/cc -> gcc
当然, cc 不过是到 gcc的链接,不过用gcc命令直接编译根本不行:
#gcc -DDMALLOC -ggdb -Wall -ldmalloc ../test.c -o test
In file included from ../test.c:48:
/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.4/include/dmalloc.h:128: error: conflicting types for 'malloc'
/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.4/include/dmalloc.h:128: error: conflicting types for 'malloc'
/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.4/include/dmalloc.h:137: error: conflicting types for 'calloc'
/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.4/include/dmalloc.h:137: error: conflicting types for 'calloc'
/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.4/include/dmalloc.h:149: error: conflicting types for 'realloc'
/usr/include/stdlib.h:567: error: previous declaration of 'realloc' was here
/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.4/include/dmalloc.h:149: error: conflicting types for 'realloc'
/usr/include/stdlib.h:567: error: previous declaration of 'realloc' was here
/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.4/include/dmalloc.h:181: error: conflicting types for 'valloc'
/usr/include/stdlib.h:583: error: previous declaration of 'valloc' was here
/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.4/include/dmalloc.h:181: error: conflicting types for 'valloc'
/usr/include/stdlib.h:583: error: previous declaration of 'valloc' was here
/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.4/include/dmalloc.h:200: error: conflicting types for 'free'
/usr/include/stdlib.h:569: error: previous declaration of 'free' was here
/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.4/include/dmalloc.h:200: error: conflicting types for 'free'
/usr/include/stdlib.h:569: error: previous declaration of 'free' was here
/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.4/include/dmalloc.h:205: error: conflicting types for 'cfree'
/usr/include/stdlib.h:574: error: previous declaration of 'cfree' was here
/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.4/include/dmalloc.h:205: error: conflicting types for 'cfree'
/usr/include/stdlib.h:574: error: previous declaration of 'cfree' was here
#cc -DDMALLOC -ggdb -Wall -ldmalloc ../test.c -o test
# 通过!
这是为什么呢?
|
|
|
[Original]
[Print]
[Top]
|
|
|