0

I'm compiling a planet map generator that requires libpng. While I successfully fixed other errors, this was impossible to remove:

png_utils.o:png_utils.c:(.text+0x91): undefined reference to `png_create_write_struct'
png_utils.o:png_utils.c:(.text+0xa4): undefined reference to `png_create_info_struct'
png_utils.o:png_utils.c:(.text+0xca): undefined reference to `png_set_longjmp_fn'
png_utils.o:png_utils.c:(.text+0x135): undefined reference to `png_set_IHDR'
png_utils.o:png_utils.c:(.text+0x14e): undefined reference to `png_malloc'
png_utils.o:png_utils.c:(.text+0x19e): undefined reference to `png_malloc'
png_utils.o:png_utils.c:(.text+0x217): undefined reference to `png_init_io'
png_utils.o:png_utils.c:(.text+0x230): undefined reference to `png_set_rows'
png_utils.o:png_utils.c:(.text+0x252): undefined reference to `png_write_png'
png_utils.o:png_utils.c:(.text+0x281): undefined reference to `png_free'
png_utils.o:png_utils.c:(.text+0x297): undefined reference to `png_free'
png_utils.o:png_utils.c:(.text+0x2af): undefined reference to `png_destroy_write_struct'
png_utils.o:png_utils.c:(.text+0x35e): undefined reference to `png_malloc'
png_utils.o:png_utils.c:(.text+0x47c): undefined reference to `png_destroy_read_struct'
png_utils.o:png_utils.c:(.text+0x4b4): undefined reference to `png_sig_cmp'
png_utils.o:png_utils.c:(.text+0x4e0): undefined reference to `png_create_read_struct'
png_utils.o:png_utils.c:(.text+0x4f3): undefined reference to `png_create_info_struct'
png_utils.o:png_utils.c:(.text+0x509): undefined reference to `png_create_info_struct'
png_utils.o:png_utils.c:(.text+0x52f): undefined reference to `png_set_longjmp_fn'
png_utils.o:png_utils.c:(.text+0x60e): undefined reference to `png_init_io'
png_utils.o:png_utils.c:(.text+0x621): undefined reference to `png_set_sig_bytes'
png_utils.o:png_utils.c:(.text+0x643): undefined reference to `png_read_png'
png_utils.o:png_utils.c:(.text+0x689): undefined reference to `png_get_IHDR'
png_utils.o:png_utils.c:(.text+0x6f2): undefined reference to `png_get_rowbytes'
png_utils.o:png_utils.c:(.text+0x718): undefined reference to `png_get_rows'
png_utils.o:png_utils.c:(.text+0x941): undefined reference to `png_destroy_read_struct'

I use MinGW-x64 and mingw32-make without msys2 installed. libpng 1.6.37-4 is installed in both folders and I used -lpng and -lpng16 but it still didn't work.

JebKerman
  • 13
  • 5
  • 1
    Does this answer your question? [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Ken White May 29 '21 at 00:21
  • Did you put (e.g.) `-lpng` as the _last_ argument to your `cc` command? – Craig Estey May 29 '21 at 00:22
  • It could be another issue in the makefile. I'll try to fix that first. I also put -lpng and -lpng16 to the end of the command. – JebKerman May 29 '21 at 00:28
  • It still didn't work. – JebKerman May 29 '21 at 01:31

1 Answers1

0

Nevermind, the program that I was compiling had a patch for Windows to prevent that error.

JebKerman
  • 13
  • 5