Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

makefile file format not recognized

Tags:

c

makefile

what i'm doing wrong? And can you send some helpful links to make my work with makefiles easier and better?

get_next_line.o: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
Makefile:27: recipe for target 'gnl' failed
make: *** [gnl] Error 1

+++

SRC = gnl.c
OBJ = $(SRC:.c=.o)
INCLUDES = gnl.h
NAME = gnl
CFLAGS = -Wall -Werror -Wextra
CC = gcc
DIR = LIBFT

%.o: %.c $(SRC) $(INCLUDES)
        $(CC) $(CFLAGS) -c $<

all: $(NAME)

$(NAME): $(OBJ)
        make -C $(DIR)
        $(CC) $(CFLAGS) -o $(NAME) $(OBJ) -L. $(DIR)/libft.a
clean:
        make clean -C $(DIR)
        rm -f $(OBJ)

fclean:
        make fclean -C $(DIR)
        rm -f $(NAME)

re: fclean all
like image 235
EmanRuoy Avatar asked Aug 16 '26 17:08

EmanRuoy


1 Answers

This is not a make error by itself. It says

get_next_line.o: file not recognized: File format not recognized

so that is your problem. Somehow you managed to have a .o file in your directory that is corrupted. Remove it and things will go better.

like image 179
Jens Gustedt Avatar answered Aug 19 '26 10:08

Jens Gustedt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!