gpt4 book ai didi

c++ - Makefile 查找 Windows 中所有 *.cpp 和 *.h 文件中断

转载 作者:太空宇宙 更新时间:2023-11-04 05:21:29 24 4
gpt4 key购买 nike

所以问题的核心是我想在Linux和Windows下都使用我的Makefile。当我使用常见的 CFILES := $(shell find $(SDIR) -name '*.cpp') 查找我的 .cpp 文件时,Windows 下的 shell 转义会调用一个环境,该环境忽略 MSYS64/bin 是在我的 PATH 中查找程序的第一个目录这一事实,并使用 Windows 内部 find 命令,该命令的功能与 unix find 程序截然不同。

所以我需要要么

a) 找到一种方法,使 Windows 下的 make shell 转义确实使用在我的 PATH 中找到的“unixary”查找

b) 找到一种无需 shell 转义即可查找所有文件的方法 ...

最佳答案

如果您也需要目录,请尝试遵循并删除 notdir 函数。

YOUR_DIRECTORY = 您的\目录\到\查找\文件的位置

YOUR_DIRECTORY_FILES = $(notdir $(shell dir/A-D/B/S $(YOUR_DIRECTORY)*.cpp ))

验证

${信息文件$(YOUR_DIRECTORY_FILES)}

关于c++ - Makefile 查找 Windows 中所有 *.cpp 和 *.h 文件中断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41455084/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com