Author Topic: ncurses linking error  (Read 3889 times)

Bernhard Pöttinger

  • Jr. Member
  • **
  • Posts: 52
  • Karma: +10/-0
    • View Profile
ncurses linking error
« on: July 24, 2021, 10:08:11 pm »
Hello, I need help with an application I try to build with gcc. The linker shows 2 undefined symbol errors:

{1}[e:\var\tmp\ucsd_pme-0.1.0\src] gcc -v configfile.o console.o boot.o disk.o graphic.o interpreter.o memory.o null.o p
me.o printer.o remote.o unit_io.o -o pme.exe -lm -lncurses -lcurses
Es werden eingebaute Spezifikationen verwendet.
COLLECT_GCC=E:\USR\BIN\gcc.exe
COLLECT_LTO_WRAPPER=E:/usr/bin/../libexec/gcc/i686-pc-os2-emx/9/lto-wrapper.exe
Ziel: i686-pc-os2-emx
Konfiguriert mit: D:/Users/dmik/rpmbuild/BUILD/gcc-os2-gcc-9_2_0-release-os2-b3/configure --disable-bootstrap --enable-l
anguages=c,c++ --build=i686-pc-os2-emx --with-sysroot=/@unixroot --prefix=/@unixroot/usr --mandir=/@unixroot/usr/share/m
an --infodir=/@unixroot/usr/share/info --with-bugurl=https://github.com/bitwiseworks/gcc-os2/issues --enable-shared --en
able-threads --enable-checking=release --disable-multilib --with-system-zlib --with-gcc-major-version-only --without-isl
 --with-tune=generic --with-arch=i686 --with-gnu-as --disable-libstdcxx-pch
Thread-Modell: os2
gcc-Version 9.2.0 20190812 (OS/2 RPM build 9.2.0-5.oc00) (GCC)
COMPILER_PATH=E:/usr/bin/../libexec/gcc/i686-pc-os2-emx/9/;E:/usr/bin/../libexec/gcc/
LIBRARY_PATH=E:/usr/bin/../lib/gcc/i686-pc-os2-emx/9/;E:/usr/bin/../lib/gcc/;E:/usr/lib/;E:/emx/lib/;E:/usr/bin/../lib/g
cc/i686-pc-os2-emx/9/../../../;/@unixroot/usr/lib/
COLLECT_GCC_OPTIONS='-pipe' '-v' '-o' 'pme.exe' '-mtune=generic' '-march=i686'
 ld.exe -o pme.exe E:/usr/lib/crt0.o -LE:/usr/bin/../lib/gcc/i686-pc-os2-emx/9 -LE:/usr/bin/../lib/gcc -LE:/usr/lib -LE:
/emx/lib -LE:/usr/bin/../lib/gcc/i686-pc-os2-emx/9/../../.. -L/@unixroot/usr/lib configfile.o console.o boot.o disk.o gr
aphic.o interpreter.o memory.o null.o pme.o printer.o remote.o unit_io.o -lm -lncurses -lcurses -lgcc_so_d -lc_alias -lc
_dll -los2 -lgcc_so_d -lc_alias -lc_dll -los2 -lgcc_so_d -lc_alias -lc_dll -los2 -lgcc_so_d -lc_alias -lc_dll -los2
console.o: Undefined symbol _raw referenced from text segment
console.o: Undefined symbol _noraw referenced from text segment

the _raw and _noraw symbols should be defined in ncurses.a:

{1}[e:\usr\lib] nm ncurses.a |grep raw
00001560 T _redrawwin
         U _wredrawln
         U _noraw
         U MouDrawPtr
lib_redrawln.o:
00000000 T _wredrawln
         U _noraw
         U _raw

I have now idea, why I get this two undefined symbols.

many thanks, and best regards
Bernhard


TeLLie

  • Full Member
  • ***
  • Posts: 226
  • Karma: +11/-0
    • View Profile
Re: ncurses linking error
« Reply #1 on: July 25, 2021, 12:06:38 am »
Hi,
Did you try to link it with tinfo.lib or tinfo_dll.a as there are those two definied on my system

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4786
  • Karma: +99/-1
    • View Profile
Re: ncurses linking error
« Reply #2 on: July 25, 2021, 12:44:44 am »
You'll probably need to link them before ncurses. Assuming you're using a makefile, try make LDFLAGS=-ltinfo

Bernhard Pöttinger

  • Jr. Member
  • **
  • Posts: 52
  • Karma: +10/-0
    • View Profile
Re: ncurses linking error
« Reply #3 on: July 25, 2021, 09:08:40 am »
thank you - "-ltinfo" did it. Now my app is building fine.
many thanks for your help and best regards
Bernhard