'ld' cannot bind characters, although they are in the library

I have a problem trying to compile and link my program with "dmalloc".

bin +--dmalloc include +--dmalloc.h lib +--libdmalloc.a +--libdmallocth.a main.c 

I have the following directory structure

Now I am trying to compile my program with the following command:

 gcc -Iinclude -Llib -ldmalloc -DDMALLOC main.c /tmp/ccSDFmWj.o: In function `main': main.c:(.text+0x29): undefined reference to `dmalloc_malloc' collect2: ld returned 1 exit status 

Well, I understand that there is a problem with a link to characters, ld just cannot find a link to dmalloc_malloc. However...

 nm lib/libdmalloc.a | grep dmalloc_malloc 0000000000001170 T dmalloc_malloc 0000000000000fe0 t dmalloc_malloc.part.6 

I am puzzled ... There is a symbol in this library. Why does ld have problems with this?

+4
source share
1 answer

List of recent libraries:

 gcc -Iinclude -Llib -DDMALLOC main.c -ldmalloc 
+5
source

Source: https://habr.com/ru/post/1401795/


All Articles