Makefile 多个目标匹配的问题

本文详细介绍了如何在Windows环境下利用mingw32-make配置ZThread库,包括设置路径、编译命令及清理目标,旨在解决在路径包含冒号时遇到的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在windows下直接使用mingw32-make

# ZTHREAD_A the static link library file of ZThread
ZTHREAD_A = F:/ZJ/tools/cpp_libs/ZThread-2.3.2/bin/zthread_win32.a
# ZTHREAD_H is the directory that has all the header
# files of the ZThread library
ZTHREAD_H = F:/ZJ/tools/cpp_libs/ZThread-2.3.2/include

test.exe: main.o Test.o LiftOff.o $(ZTHREAD_A)
    g++ -o test.exe main.o Test.o LiftOff.o -s $(ZTHREAD_A)
main.o: main.cpp
    g++ -c main.cpp -o main.o
# '-I' specifies the header search directory
Test.o: Test.cpp Test.h
    g++ -I $(ZTHREAD_H) -c Test.cpp -o Test.o
LiftOff.o: LiftOff.cpp LiftOff.h
    g++ -I $(ZTHREAD_H) -c LiftOff.cpp -o LiftOff.o

# PHONY means 'clean' is a fake target
# use 'make clean' to remove all .o files
# before rebuilding
# '-' means continue execute next command even if something goes wrong with this command
.PHONY: clean
clean:
    -del test.exe
    -del *.o

把红色部分删去就是了,因为路径中有冒号!

而且本来.a文件就不应该出现在依赖关系中,低级错误。。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值