Thursday, September 24, 2009

Can someone tell the possible reason for these errors?

/tmp/cc28G9dV.o: In function `io_init':
ciol.c:(.text+0x7): undefined reference to `initscr'
ciol.c:(.text+0xc): undefined reference to `noecho'
ciol.c:(.text+0x11): undefined reference to `cbreak'
ciol.c:(.text+0x16): undefined reference to `stdscr'
ciol.c:(.text+0x26): undefined reference to `keypad'
/tmp/cc28G9dV.o: In function `io_end':
ciol.c:(.text+0x3d): undefined reference to `endwin'
/tmp/cc28G9dV.o: In function `io_flush':
ciol.c:(.text+0x4a): undefined reference to `stdscr'
ciol.c:(.text+0x52): undefined reference to `wrefresh'
/tmp/cc28G9dV.o: In function `io_getch':
ciol.c:(.text+0x64): undefined reference to `stdscr'
ciol.c:(.text+0x6c): undefined reference to `wgetch'

This is how I attempted to compile the text editor files using Linux
cc ciol.c keycode.c

Is there a particular built-in library that should be added?

2 comments:

  1. Hi ausley, make sure you include the "ncurses.h" header file when coding for Linux. Other than that, I wish you luck.

    ReplyDelete
  2. Those errors are all linker errors. Thus, what is missing are the compiled code for those functions For those particular errors, its probably because you forgot to add the curses lib to your command line.
    your compilation statement should be:

    c++ blah blah -lcurses

    (or if the lib name is ncurses -lncurses ... change it to whatever lib you need)

    ReplyDelete