Linux compiled C + + program encountered error: undefined reference to ' * * * * Storage

Source: Internet
Author: User

In today's Linux environment, there is a strange phenomenon, the link to the dynamic library is always reported similar to the following error:

(. text+0x13): Undefined reference to ' func '

The following are some of the inspection scenarios available:

1. If you hint that an undefined function is a function of a library. Check that the library is installed and import the library with the-L and-L parameters in the compilation command.
2. If you are prompted that an undefined function is a function in your program. Check whether in the header file, whether there is a corresponding obj file in the compilation, check whether the function or variable name is correct, whether it is due to inconsistent spelling.
3, if the hint is not defined function is a function in the program, there is a very hidden possibility: Check the context of the change function code has #ifdef or #ifndef, such as precompiled information, which is likely to cause the relevant code has not been compiled and appear "undefined reference to" Tips.

Related Article

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.