Acabo de pasar unas horas en un procesador ARM, tratando de que funcione, ya que la respuesta aceptada no funcionó para mí.
Aquí están mis resultados:
Al parecer
gcc -static hello_curses.c -o curses -lncurses
obras en un procesador x64, pero no en un procesador ARM.
Cuando probé con la línea anterior, todavía obtuve todos los "errores de referencia indefinidos" (y mucho más) del OP.
También necesita vincular con libtinfo.a, y tenga en cuenta que la secuencia es importante.
Esta es la línea de comandos correcta que funciona:
gcc -static hello_curses.c -o curses -lncurses -ltinfo
Si mezcla la secuencia, entonces no va a funcionar ...
gcc -static hello_curses.c -o curses -ltinfo -lncurses
undefined reference to `unctrl'
Por supuesto, esto también funciona si se utiliza el: sintaxis lib
Esto compila
gcc -static hello_curses.c -o curses -l:libncursesw.a -l:libtinfo.a
Esto no compila
gcc -static hello_curses.c -o curses -l:libtinfo.a -l:libncursesw.a
Oh, cómo me gusta gcc ...
Este programa nunca debería haber sido autorizado a graduarse de kindergarden
(.text+0x2a8): undefined reference to cur_term' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_color.o): In function
init_pair': (.text+0x2ac): undefined reference to cur_term' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_color.o): In function
init_pair': (.text+0x50a): undefined reference to tparm' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_color.o): In function
init_pair': (.text+0x518): undefined reference to _nc_putp' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_color.o): In function
init_color': (.text+0x552): undefined reference to cur_term' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_color.o): In function
init_color': (.text+0x556): undefined reference to cur_term' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_color.o): In function
init_color': (.text+0x5e4): undefined reference to tparm' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_color.o): In function
init_color': (.text+0x5f2): undefined reference to _nc_putp' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_color.o): In function
can_change_color': (.text+0x740): undefined reference to cur_term' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_color.o): In function
can_change_color': (.text+0x744): undefined reference to cur_term' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_color.o): In function
has_colors': (.text+0x768): undefined reference to cur_term' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_color.o): In function
has_colors': (.text+0x76c): undefined reference to cur_term' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_color.o): In function
color_content': (.text+0x7c2): undefined reference to cur_term' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_color.o):(.text+0x7c6): more undefined references to
cur_term' follow /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_color.o): In function _nc_do_color': (.text+0x8de): undefined reference to
tparm' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_color.o): In function _nc_do_color': (.text+0x8e6): undefined reference to
tputs' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_color.o): In function _nc_do_color': (.text+0x958): undefined reference to
tputs' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_color.o): In function set_foreground_color': (.text+0x62): undefined reference to
tputs' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_color.o): In function set_background_color': (.text+0xa2): undefined reference to
tputs' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_hline.o): In function whline': (.text+0xec): undefined reference to
acs_map' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_hline.o): In function whline': (.text+0xf0): undefined reference to
acs_map' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_add_wch.o): In function wadd_wch': (.text+0x4fe): undefined reference to
TABSIZE' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_add_wch.o): In function wadd_wch': (.text+0x502): undefined reference to
TABSIZE' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_add_wch.o): In function wecho_wchar': (.text+0x6d8): undefined reference to
TABSIZE' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_add_wch.o): In function wecho_wchar': (.text+0x6dc): undefined reference to
TABSIZE' /usr/lib/gcc/arm-linux-gnueabihf/4.8/../../../arm-linux-gnueabihf/libncursesw.a(lib_wunctrl.o): In function wunctrl': (.text+0x30): undefined reference to
unctrl' collect2: error: ld returned 1 exit status
¿Está utilizando '-static' porque ¿Quieres que las bibliotecas de C también estén vinculadas estáticamente? – Troubadour
sí, todo tiene que estar vinculado estáticamente – mdogg
Posible duplicado de [¿Por qué el orden en el que las bibliotecas están vinculadas a veces causa errores en GCC?] (Http://stackoverflow.com/questions/45135/why-does-the-order-in -qué-bibliotecas-están-vinculadas-a veces-causa-errores-en-gcc) –