summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAsbjørn Sloth Tønnesen <ast@2e8.dk>2023-07-08 22:26:27 +0000
committerAsbjørn Sloth Tønnesen <ast@2e8.dk>2023-07-10 19:51:28 +0000
commit84feb345eaf2a73abe4d1f9d2155edc058a8e570 (patch)
treec3976290216b615a8cf1b1c322710fd5dea402b8
parent39b1f985c9037373a435a0c50e33602a06e26369 (diff)
downloadqlprint-84feb345eaf2a73abe4d1f9d2155edc058a8e570.tar.gz
qlprint-84feb345eaf2a73abe4d1f9d2155edc058a8e570.tar.xz
qlprint-84feb345eaf2a73abe4d1f9d2155edc058a8e570.zip
Makefile: fix undefined references
Compiling gives the following error, since the library is specified before the local objects: $ make […] cc -lpng16 build/main.o build/ql.o build/loadpng.o -o build/qlprint /usr/bin/ld: build/loadpng.o: in function `loadpng': …/src/loadpng.c:30: undefined reference to `png_sig_cmp' /usr/bin/ld: …/src/loadpng.c:35: undefined reference to `png_create_read_struct' /usr/bin/ld: …/src/loadpng.c:39: undefined reference to `png_create_info_struct' /usr/bin/ld: …/src/loadpng.c:43: undefined reference to `png_create_info_struct' […] collect2: error: ld returned 1 exit status make: *** [Makefile:28: build/qlprint] Error 1 After reordering: $ make […] cc build/main.o build/ql.o build/loadpng.o -lpng16 -o build/qlprint
-rw-r--r--Makefile2
1 files changed, 1 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index d170eb3..767c268 100644
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,7 @@ build/%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
build/qlprint: $(OBJS)
- $(CC) $(LDFLAGS) $^ -o $@
+ $(CC) $^ $(LDFLAGS) -o $@
$(OBJS): $(wildcard include/*) Makefile