首页 > 解决方案 > Makefile 没有创建可执行文件。是否包含导致错误的 .txt 文件?

问题描述

对于我正在学习的课程,我们正在学习使用 Makefile。我的问题是当我完全运行我的文件时,我在编译器中收到一个错误,让我知道我的文件无法清理并且没有目录。我已经在没有 .txt 文件的情况下运行了很多次,但仍然没有找到相关文件的目录。我查看了 GNU 指南,但没有看到 .txt 文件的示例,所以我想知道这是否是问题所在。我的makefile代码如下

CXX = g++  # the compiler
CXXFLAGS = -std=c++17 -Wall  # flags for the compiler (use c++17 standards, turn on all optional warnings);

all: main
    
main: pe3_references.cpp 
    $(CXX) $(CXXFLAGS) pe3_bash.txt pe3_references.cpp main
    
clean: 
    rm main 

这是 pe3_bash.txt 文件。只是答案。

1. pwd
2. vim empty.txt
3. ls empty*
4. ls *.txt | wc -l
5. echo "Tj Mmorosa" > empty.txt
6. mv empty.txt notempty.txt
7. mkdir pe3_bash
8. cd pe3_bash
9. mkdir pe3_bash_number2
10. cd pe3_bash_number2
11. Up key shows previous inputs to terminal
12. Down key moves in reverse direction of inputs to terminal
13. ctrl+r is used to search previous commands
14. 1)vim empty.txt
      nano empty.txt
    2) :wq (for vim)
      ctrl+x (for nano)
    3) :q (vim)
        ctrl+x (nano)
15. Command line text editors are quicker and easily accessible.
*/

在此处输入图像描述, 我将不胜感激。(顺便说一句,我只有一个 pe3_references.cpp、pe3_bash.txt 和 Makefile 文件,如果有帮助的话)

标签: c++makefile

解决方案


推荐阅读