1, Problem Description:
This error is prompted when compiling a program:
BLog.cpp: (. text+0x5fc): Undefined reference to ' Shm_unlink '
DBLog.cpp: (. text+0x610): Undefined reference to ' Shm_open '
/HOME/SCS/INSTALL/LIB/LIBLOG4CPLUS.A (TIMEHELPER.O): in function ' Log4cplus::helpers::time::gettimeofday () ':
/mnt/hgfs/07svn/program/sdk/log4plus/log4cplus-1.1.0/log4cplus-1.1.0/src/timehelper.cxx:102:undefined Reference To ' Clock_gettime '
/HOME/SCS/INSTALL/LIB/LIBLOG4CPLUS.A (SLEEP.O): in function ' Unix_nanosleep ':
/mnt/hgfs/07svn/program/sdk/log4plus/log4cplus-1.1.0/log4cplus-1.1.0/src/sleep.cxx:52:undefined reference to ' Clock_nanosleep '
COLLECT2:LD return 1
2. Solutions
In the previous compile time is not wrong, just the original link to the liblog4cplus.so changed to LIBLOG4CPLUS.A, and then compile the error, on-line search on the need to add-LRT options, compiled through.
3,-LRT
Http://www.lehman.cuny.edu/cgi-bin/man-cgi?librt+3
The RT library is a runtime library that provides some additional function definitions.
Undefined reference to ' Shm_unlink '