makefile运行make: *** no targets. stop
时间: 2023-11-07 11:50:25 浏览: 53
这个错误通常是因为在Makefile中没有定义任何目标。Makefile需要包含一些规则来告诉make命令如何构建目标。请确保Makefile中至少定义了一个目标,并在规则中指定了构建步骤。例如,以下是一个简单的示例Makefile:
```
all:
gcc -o myprogram main.c
clean:
rm myprogram
```
在这个示例中,我们定义了两个目标:`all`和`clean`。`all`目标使用gcc编译器将main.c文件编译为名为myprogram的可执行文件。`clean`目标用于清理编译生成的文件。
确保你的Makefile中有类似的规则,并确保在运行`make`命令时指定了正确的目标。
相关问题
make: *** No targets. Stop.
当出现"make: *** No targets. Stop."错误提示时,通常是由于缺少Makefile文件或Makefile文件中没有指定目标导致的。解决方法如下:
1. 确认当前目录下是否存在Makefile文件,如果不存在则需要创建一个Makefile文件。
2. 如果存在Makefile文件,则需要检查Makefile文件中是否指定了目标。可以通过在Makefile文件中添加以下内容来指定目标:
```
all:
gcc -o program program.c
```
其中,all是目标名称,gcc -o program program.c是编译命令。
3. 如果Makefile文件中已经指定了目标,但是仍然出现"make: *** No targets. Stop."错误提示,则可能是由于Makefile文件中的空格或Tab键不正确导致的。在Makefile文件中,命令必须以Tab键开头,而不能以空格开头。
4. 如果以上方法都无法解决问题,则可以尝试使用以下命令清除缓存并重新编译:
```
make clean
make
```
Redis安装:make: *** No targets specified and no makefile found. Stop.
当Redis安装时出现"make: *** No targets specified and no makefile found. Stop."的错误时,可以尝试以下解决方法:
1. 确保已经正确下载并解压了Redis源代码文件。
2. 进入Redis源代码文件所在的目录,通常是通过cd命令进入该目录。
3. 运行make命令进行编译,如果出现报错信息,可以尝试先安装gcc编译器,可以通过执行"apt-get install gcc"命令来安装。
4. 如果仍然无法解决问题,可以尝试将Redis解压文件删除,重新解压,并再次执行make命令。
5. 进入Redis的src目录,执行make命令。
6. 最后一种方式是进入Redis目录(例如/opt/redis),执行make命令。
通过以上步骤,您应该能够成功解决"make: *** No targets specified and no makefile found. Stop."的错误并完成Redis的安装。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)