I g0t the following error when compiling the basic ncurses tutorial program from here:
#gcc ncur.c -o ncur /tmp/ccgxJG8O.o: In function `main': ncur.c:(.text+0x10): undefined reference to `initscr' ncur.c:(.text+0x15): undefined reference to `cbreak' ncur.c:(.text+0x1c): undefined reference to `stdscr' ncur.c:(.text+0x29): undefined reference to `keypad' ncur.c:(.text+0x3d): undefined reference to `LINES' ncur.c:(.text+0x52): undefined reference to `COLS' ncur.c:(.text+0x70): undefined reference to `printw' ncur.c:(.text+0x77): undefined reference to `stdscr' ncur.c:(.text+0x7f): undefined reference to `wrefresh' ncur.c:(.text+0x179): undefined reference to `stdscr' ncur.c:(.text+0x181): undefined reference to `wgetch' ncur.c:(.text+0x196): undefined reference to `endwin' /tmp/ccgxJG8O.o: In function `create_newwin': ncur.c:(.text+0x1c4): undefined reference to `newwin' ncur.c:(.text+0x209): undefined reference to `wborder' ncur.c:(.text+0x215): undefined reference to `wrefresh' /tmp/ccgxJG8O.o: In function `destroy_win': ncur.c:(.text+0x268): undefined reference to `wborder' ncur.c:(.text+0x274): undefined reference to `wrefresh' ncur.c:(.text+0x280): undefined reference to `delwin' collect2: error: ld returned 1 exit status
Solution: You need to link against the ncurses library:
#gcc ncur.c -o ncur -lncurses #
Joel G Mathew, known in tech circles by the pseudonym Droidzone, is an opensource and programming enthusiast.
He is a full stack developer, whose favorite languages are currently Python and Vue.js. He is also fluent in Javascript, Flutter/Dart, Perl, PHP, SQL, C and bash shell scripting. He loves Linux, and can often be found tinkering with linux kernel code, and source code for GNU applications. He used to be an active developer on XDA forums, and his tinkered ROMS used to be very popular in the early 2000s.
His favorite pastime is grappling with GNU compilers, discovering newer Linux secrets, writing scripts, hacking roms, and programs (nothing illegal), reading, blogging. and testing out the latest gadgets.
When away from the tech world, Dr Joel G. Mathew is a practising ENT Surgeon, busy with surgeries and clinical practise.