【发布时间】:2018-07-22 00:15:03
【问题描述】:
我正在开发一个程序,其中我使用 i686-w64-mingw32-gcc.exe 使用 PDCurses3.5 函数。
当我编译程序时,我不断收到诸如"undefined reference to 'COLS'"、"undefined reference to 'lines'" 之类的错误。
我检查了<curses.h> 标头和库包是否正确安装。
这是我的输入行:
> i686-w64-mingw32-gcc.exe set.o read.o elements.o random.o
> -L../standard/test -lplotfit -lplotget -lgfortran -Wl,--subsystem,console -mwindows -o runtime/mingw/result -lm -static -lws2_32 -lpdcurses
错误的第一部分是:
../standard/bin/mingw/menu.o:menu.c:(.text+0xb): undefined reference to `COLS'
../standard/bin/mingw/menu.o:menu.c:(.text+0x16): undefined reference to `COLS'
../standard/bin/mingw/menu.o:menu.c:(.text+0x33): undefined reference to `LINES'
../standard/bin/mingw/menu.o:menu.c:(.text+0x47): undefined reference to `MOVE'
../standard/bin/mingw/menu.o:menu.c:(.text+0x74): undefined reference to `initscr'
...
该程序似乎无法在其库文件中引用 libpdcurses.a。 我做错了什么?
【问题讨论】:
-
您是否检查了 libpdcurses.a 的路径,您可以尝试将 libpdcurses.a 复制到 gcc 链接器运行的当前目录,然后重试。在 Msys2 中,我成功编译并运行 pdcurses 库。
标签: c linker-errors undefined-reference pdcurses