2

这是我的目录结构:

C:.
│   lodepng.h
│   lodepng.c
│   nim.cfg
│   test.png
│   util.nim
│
└───nimcache

util nim 正在从 lodepng.h 导入 ac 函数,如下所示:

proc loadPNG(image: var ptr[cchar], width, height: var cuint, filename: cstring)
  {.importc: "lodepng_decode32_file", header: "lodepng.h".}

但是头文件没有复制到 nimcache 中,编译代码时也找不到。我如何确保 nim 编译器使用它?

4

1 回答 1

1

我在 nim后端集成指南中找到了解决方案:

{.compile: "lodepng.c".}
proc lodepng_decode32_file(image: var ptr[cchar], width, height: var cuint, filename: cstring): cuint {.importc.}
于 2015-06-20T19:22:33.920 回答