Undefined reference to ' Shm_unlink '

Source: Internet
Author: User

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 '

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.