我的 makefile(我仍在学习)遇到了一些问题,我现在似乎不明白是什么导致了这个问题。
我一直在运行这个 Makefile:
CC = cc
CFLAGS = -Wall -Wextra -Werror
NAME = libftprintf.a
NAMELFT = libft.a
SRCS = ft_printf.c ft_flags.c ft_printf_utils_1.c ft_printf_utils_2.c ft_printf_utils_3.c ft_printf_utils_4.c ft_itoa2.c
OBJS = $(SRCS:.c=.o)
LIBFT = libft/libft.a
all: $(NAME)
bonus: all
$(NAME): $(OBJS) $(LIBFT)
ar rc $(NAME) $(OBJS)
$(LIBFT):
${MAKE} -C ./libft
clean: $(MAKE) clean -C ./libft
rm -rf $(OBJS)
fclean: clean
$(MAKE) fclean -C ./libft
rm -rf $(NAME)
re: fclean all
--
我一直收到这个错误,即使我试图改变一些语法:
Undefined symbols for architecture arm64:
"\_ft_strlen", referenced from:
\_ft_print_hex in libftprintf.a(ft_printf_utils_4.o)
\_ft_get_hex_len in libftprintf.a(ft_printf_utils_4.o)
\_ft_get_hex_zeros in libftprintf.a(ft_printf_utils_4.o)
\_ft_print_uns in libftprintf.a(ft_printf_utils_3.o)
\_ft_fill_int_zeros in libftprintf.a(ft_printf_utils_3.o)
\_ft_print_str in libftprintf.a(ft_printf_utils_2.o)
\_ft_check_flags in libftprintf.a(ft_printf_utils_2.o)
...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: \*\*\* \[c\] Error 1