温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

QT 编译错误汇聚

发布时间:2020-10-13 04:55:09 来源:网络 阅读:894 作者:WZM3558862 栏目:开发技术

编译提示

 

make: *** No rule to make target 错误原因、分析和解决办法

:-1: error: No rule to make target 'wqLineItem.cpp', needed by 'debug/wqLineItem.o'.  Stop.


QT 编译错误汇聚


原来这个原因是丢失文件啊 ,终于明白了 ,看来网上的代码不可信

有个已有的Makefile,执行过程中出错:

CLi@PC-CLI-1 ~/develop/docbook/books/python_topic_str_encoding/src 
$ make html 
=============================== cleaning html ============================== 
rm -rf ../output/html/single/* 
make: *** No rule to make target ` ‘, needed by `../output/html/single/python_topic_str_encoding.html’.  Stop.

 

【解决过程】

1.换到别的,和当前文件夹等价的路径中去执行,结果却是正常的:

CLi@PC-CLI-1 ~/develop/docbook/books/python_topic_str_encoding/src 
$ cd ../../python_topic_web_scrape/src

CLi@PC-CLI-1 ~/develop/docbook/books/python_topic_web_scrape/src 
$ make html 
=============================== cleaning html ============================== 
rm -rf ../output/html/single/* 
=============================== generating html ============================== 
export XML_CATALOG_FILES="/home/develop/docbook/config_root/catalog/catalog.xml" && \ 
export XML_DEBUG_CATALOG=1 && \

……

 

2.后来折腾半天,最后终于发现,原来是由于,当前Makefile中的内容是:

?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# also means main source file name
PROJECT_NAME = python_topic_str_encoding
SUB_SRC_FILES = \
    python_topic_str_encoding.xml \
    preface.xml \
    ch01_2x_vs_3x.xml \
    ch02_common_encoding_error.xml \
    ch03_other_common_case.xml \
    reference.xml \   
 
DOCBOOK_MAKEFILE_ROOT = ../../../config
################################################################################
# Include docbook makefile
################################################################################
include $(DOCBOOK_MAKEFILE_ROOT)/docbook.mk

其中,注意到,所依赖的

reference.xml \

后面还有几个空格的,截图才能看出来:

QT 编译错误汇聚

导致了此错误。

把最后的,多余的空格去掉:

QT 编译错误汇聚

就可以消除此问题了。

 

【总结】

Makefile在编译执行过程中,对于所依赖的条件,此处即一堆xml文件,最后一个是reference.xml,结果由于最后reference.xml后面,有多余的4个空格,导致Makefile将该处的4个空格,视为一个文件了,所以,必然找不到该“文件”,所以才报错的。

所以,如果Makefile出现:

make: *** No rule to make target ` ‘, needed by xxx. Stop.

的错误,那么基本上都是属于找不到所依赖的文件所导致的,所以应该去:

检测确保,所依赖的文件,是否真实存在。

很可能,很常见的一个现象就是,此处的,误写了多余的空格,导致被视为依赖文件,导致找不到,导致报此错误。

解决办法就很简单,去掉多余的空格即可。


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI