How to make Neovim work with makefiles?

I have the following code structure:


And here’s the makefile:
_DEPS = event.h
_OBJ = event.o
_MOBJ = main.o
_TOBJ = test.o

APPBIN = event_time_app
TESTBIN = event_time_test

IDIR = include
CC = gcc
CFLAGS = -I$(IDIR) -Wall -Wextra -g -pthread
ODIR = obj
SDIR = src
LDIR = lib
TDIR = test
LIBS = -lm
XXLIBS = $(LIBS) -lstdc++ -lgtest -lgtest_main -lpthread
DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS))
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))
MOBJ = $(patsubst %,$(ODIR)/%,$(_MOBJ))
TOBJ = $(patsubst %,$(ODIR)/%,$(_TOBJ))
SRC = $(wildcard $(SDIR)/*.c)

$(ODIR)/%.o: $(SDIR)/%.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)

$(ODIR)/%.o: $(TDIR)/%.cpp $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)

all: $(APPBIN) $(TESTBIN) submission-event-time.zip

Shorter names for convenience and more granular targeting

app: $(APPBIN)

test: $(TESTBIN)

sub: submission-event-time.zip

$(APPBIN): $(OBJ) $(MOBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)

$(TESTBIN): $(TOBJ) $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(XXLIBS)

submission-event-time.zip: $(SRC) $(DEPS)
zip submission-event-time.zip $(SRC) $(DEPS)

.PHONY: clean

clean:
rm -f $(ODIR)/.o ~ core $(IDIR)/~ $(SDIR)/~
rm -f $(APPBIN) $(TESTBIN)
rm -f submission-event-time.zip

However, in the event.c file, neovim lsp keeps showing that some methods were not defined (in fact it was, in file event.h) as shown in the above photo. How do I config Neovim lsp so that it stops showing errors, because when I run make, there is in fact no error?

Hello,

Have you solved this yet? I don’t actually know why it isn’t working for you, but I’m happy to try and help if it’s an issue you’re still struggling with.

This might help you