I’ve used GPT4 to build source code for a while, but for the life of me, I cannot make it complete this request - it hangs in the same place every time I try. Here’s the prompt:
Based on this makefile, make one that recursively builds all .c files in the source/ directory
CC=gcc
CFLAGS=$(shell pkg-config --cflags gtk+-3.0 webkit2gtk-4.0)
LIBS=$(shell pkg-config --libs gtk+-3.0 webkit2gtk-4.0)
all: main
main: source/main.c
$(CC) $(CFLAGS) source/main.c -o exet $(LIBS)
clean:
rm -f exet
It responds:
CC=gcc
CFLAGS=$(shell pkg-config --cflags gtk+-3.0 webkit2gtk-4.0)
LIBS=$(shell pkg-config --libs gtk+-3.0 webkit2gtk-4.0)
# Directory containing source files
SRC_DIR := source
# Finds all .c files in SRC_DIR
SOURCES := $(shell find $(SRC_DIR) -name '*.c')
# Converts the list of source files into a list of corresponding object files
OBJECTS := $(SOURCES:.c=.o)
# Name of the final executable
EXECUTABLE := exet
# Default target
all: $(EXECUTABLE)
# Linking all objects into the executable
$(EXECUTABLE): $(OBJECTS)
$(CC) $(OBJECTS) -o $@ $(LIBS)
# Compiling each source file into an object file
%.o: %.c
$(CC) -c $(CFLAGS) $ <- stop here every time
And it says “network error”.
When I retry, or tells it it made an error, it tries to generate the same solution over and over again and never manages to get it done. Sometimes it gets in an infinite loop and tries to insert a “<” character after the $ sign, which is illegal.
Help?