Linking testdbm with /usr/lib/libndbm.so causes undefined references to testdbm.o(.text+0x1c0): undefined reference to `fetch' testdbm.o(.text+0x2a1): undefined reference to `store' testdbm.o(.text+0x328): undefined reference to `delete' testdbm.o(.text+0x35d): undefined reference to `firstkey' testdbm.o(.text+0x384): undefined reference to `fetch' testdbm.o(.text+0x3e9): undefined reference to `nextkey' testdbm.o(.text+0x413): undefined reference to `fetch' testdbm.o(.text+0x469): undefined reference to `firstkey' testdbm.o(.text+0x49d): undefined reference to `nextkey' collect2: ld returned 1 exit status In fact the referenced entry points are not in the library.
ndbm is not gdbm, do not confuse the two.