Hello I can't make my Makefile working with
$(CC) $(CFLAGS) $(INC) $(OBJS) $(MLX_LNK) -o $(NAME).
got a
clang -O3 -Wall -Wextra -Werror -I -I cub3d.h src/cub3d.o src/checks/argvcheck.o src/checks/parse_map.o src/libft/basics.o src/libft/basics_bis.o src/libft/get_next_line.o src/utils/errors.o -L minilibx_opengl -lmlx -framework OpenGL -framework AppKit -o cub3D clang: error: cannot specify -o when generating multiple output files make: *** [cub3D] Error 1 The command on terminal I do is "make test1"
I also tried with $(CC) $(CFLAGS) -I $(HEADER) $(OBJS) $(MLX_LNK) -o $(NAME).
but got
Compiling... clang -O3 -Wall -Wextra -Werror -I cub3d.h src/cub3d.o src/checks/argvcheck.o src/checks/parse_map.o src/libft/basics.o src/libft/basics_bis.o src/libft/get_next_line.o src/utils/errors.o -L minilibx_opengl -lmlx -framework OpenGL -framework AppKit -o cub3D Undefined symbols for architecture x86_64: "_init_cube", referenced from: _init_game in cub3d.o "_write_errors", referenced from: _verify_line in argvcheck.o _ft_parse_cub in argvcheck.o _my_get_next_line in get_next_line.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Many thanks for your help
Makefile here :
NAME = cub3D HEADER = cub3d.h CC = clang CFLAGS = -O3 -Wall -Wextra -Werror INC = -I $(MLX-DIR) -I $(HEADER) MLX_DIR = minilibx_opengl MLX_LNK = -L $(MLX_DIR) -lmlx -framework OpenGL -framework AppKit SRCS = src/main.c \ src/checks/argvcheck.c \ src/libft/basics.c \ src/libft/get_next_line.c \ src/utils/errors.c \ OBJS = $(SRCS.c=.o) all: $(NAME) mlx: $(MLX-DIR) @echo "\033[34m-= Making libX.a... =-" @make -C $(MLX_DIR) $(NAME): ${OBJS} mlx $(CC) $(CFLAGS) $(INC) $(OBJS) $(MLX_LNK) -o $(NAME) test1: $(NAME) $(NAME) ; ./a.out maps/test1.cub clean: @echo "\033[0;31mCleaning..." rm -f $(OBJS) # + $(B_OBJ) # + rm -f bitmap.bmp @echo "\033[0m" fclean: clean @echo "\033[34m-= Cleaning mlx... =-" @make clean -C $(MLX_DIR) @echo "\033[0;31mRemoving executable..." rm -f $(NAME) @echo "\033[0m" re: fclean all .PHONY: all clean fclean re ````