C + + multi-project static library call problem

Source: Internet
Author: User

A solution for a C + + project may consist of multiple sub-projects, and when a subproject calls other sub-projects, it is prone to multiple compilation problems, making the following records of the problems encountered in the work.

1. Generating a static library (Lib)

Select the current project, and then select the Project--Properties (or select items, right-click Properties)--Configure properties--general, and then modify the configuration type to static library (. Lib), such as:

2. Call the static library

This process can be broadly divided into three steps:

(1) Select items--Properties--Configure Properties--C + +, and then modify the "Additional Include Directories" to add the header file directories for the Static library (Lib), which can be used with absolute or relative paths, such as:

(2) Select items--Properties--Configure properties--connector, and then modify the "Additional Library directory" to add the static library (LIB) directory, you can use the absolute path or relative path, such as:

(3) Select the item--Properties--and configure properties---and the connector--enter, and then modify the additional dependencies to add the name of the Static library (Lib), such as:

3. Compile the project build executable file

When you call more than one static library to compile, you can see "Library file connection" and other errors, this time need to check the "Runtime Library" of multiple sub-projects is consistent, I have encountered such errors, this delay a lot of time, open the "Run-Time Library" step: Project--Properties--and configuration Properties-- -C + +---code generation such as:

C + + multi-project static library call problem

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.