There are no defined application solutions for the link under Linux

Source: Internet
Author: User

When you build a program under Linux, you first need to compile it into an. o file, followed by a link. An undefined application error occurs when linking, and the root cause is that the function cannot be found, but there are several possibilities for the phenomenon:

1. The function name in the source program is inconsistent, let's say A.C is a function, when the B file is called, the A1 will cause the function to be found.

2. When the linked O file is not in a folder, you also need to consider the path input is not correct, the principle is similar to the first one.

3 when linking. o The file is in the wrong order, and because of dependencies between function calls, improper link order can also cause undefined appearance.

4. When using makefile for large-program compilation links, similar to the third possible cause, it is possible that the order of the linked libraries is not defined as a result of improper ordering. For example, the main program needs static link X.A,Y.A,Z.A, while x.a needs the function in Z.a, the makefile should be written as follows:

MAIN_LDADD=Z.A x.a y.a rather than x.a,y.a,z.a;

There are no defined application solutions for the link under Linux

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.