Problem 1: gcc compilation always undefined reference to 'dbm _ open'
Description:
Gcc-I/user/include-L/user/lib-o dbm1 dbm1.c-lgdbm
This statement always fails. I installed dbm once through the deb package, and its files were included in/usr/include and/user/lib, respectively. An error occurred while compiling. So I tried to download the source file myself, compile it myself, http://Ubuntu.cn99.com/ubuntu/pool/main/g/gdbm/
The compiled files are in/user/local/include and/user/local/lib respectively. If I include the files and compile them, an error occurs. Realize that the problem is not in the file.
The real problem is that if gdbm is used, it must be compatible with dbm or ndmb, and gdbm_compat should be connected during compilation. Using the following command, I passed.
Gcc-I/user/include-L/user/lib-o dbm1 dbm1.c-lgdbm-lgdbm_compat
If you compile the file by yourself, first./configure, then make install, and then make install-compat (this is the extension installed ). Read the README files in the downloaded package.
Problem 2: ndbm. h not found
Specific description: After gdbm is installed using the deb package, the required ndbm. h header file cannot be found. But you will find a file named gdbm-ndbm.h, you just need to change the file name to ndbm. h, of course, you need some permissions.
Sudo cp '/usr/include/gdbm-ndbm.h ''/usr/include/ndbm. H'
In this case, OK.