Error note for qmake prolactin TEMPLATE = subdir

Source: Internet
Author: User

Recently, an error occurred while using qmake, prolactin, and TEMPLATE = subdir. Record for later viewing.

Project Structure:

 

 
 
  1. project.pro 
  2. main\ 
  3.     \__ main.pro 
  4. lib\ 
  5.     \__ lib.pro 

Project. pro:

 
 
  1. TEMPLATE  = subdirs 
  2. SUBDIRS = main lib 
  3. main.depends = lib

In main. pro, there is a sentence:

 

 
 
  1. CONFIG += link_prl 

Lib. pro has the following sentence:

 

 
 
  1. CONFIG += create_prl 

The error is:

1. lib files and dynamic libraries are generated successfully.

2. The main project does not read the content in the top 5.

 

At first, I thought it was the issue of ld during the connection period. After practice, I ruled out this possibility.

Finally, I found something strange in Makefile. Is the Makefile file corresponding to project. pro:

 

 
 
  1. sub-main: main/$(MAKEFILE) sub-lib 
  2.     cd main/ && $(MAKE) -f $(MAKEFILE) 

That is to say,

Fact 1: main first generates its own Makefile from main. pro, and then make sub-lib target.

At the same time, we know that

Fact 2: prolactin is read in the qmake stage.

Therefore, we can conclude that:

Inference 1: when the main qmake is executed, the library object's top 5 files and dynamic library files are not yet generated. This will inevitably cause the main to be unable to read the library generated by lib.

In fact, the final solution is helpless. In the project. pro, the order of main and lib is reversed and then compiled. Everything is normal.

This article is from the "elephant_liu" blog, please be sure to keep this source http://elephantliu.blog.51cto.com/1107116/835870

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.