0

I have been trying to follow this blog and I have run all the steps successfully but however when I run the last command

konanc $COMPILER_ARGS -target macbook src/main/kotlin/logogen.kt -library build/c_interop/png -linkerOpts "-L/usr/local/lib -lpng" -o build/bin/logogen

I get errors which say sqrt,pow,fopen,fclose are all unresolved

error: unresolved reference: sqrt

This is what is in my png.def file

headers = /usr/local/include/png.h stdio.h stdlib.h string.h math.h

Imported it in my logogen.kt file as

import png.*

Thank you!

2 Answers2

1

compilerOpts = -lm in the .def file shall do the trick.

Nikolay Igotti
  • 580
  • 2
  • 7
0

What are you replacing $COMPILER_ARGS with? Presumably you pass there the C libraries that define those C references and which are required by your program. For example, for the sqrt undefined reference you would add '-lm'. Same for anything else that the compiler tells you is missing.

Grzegorz Adam Hankiewicz
  • 7,349
  • 1
  • 36
  • 78