Thank you for pointing this out!
I used extern "C" { #include "termcap.h" }
and it still throws the error when I compile.
I did make a bit of progress however. I discovered that ncurses.h does something similar to termcap. I went to HaikuDepot and found a package called ncurses6_devel
I swiftly installed this, and to my delight, I see ncurses.h
and termcap.h
in boot/system/develop/headers
awesome! I compiled my program, new error. Perhaps you can help me with this PulkoMandy…
~/Desktop/top> gcc -o top top.cpp
top.cpp: In function 'void sigint_handler(int)':
top.cpp:77:9: error: 'tputs' was not declared in this scope; did you mean 'puts'?
77 | tputs(exit_ca_mode, 1, putchar);
| ^~~~~
| puts
top.cpp: In function 'void init_term()':
top.cpp:89:9: error: 'tgetent' was not declared in this scope; did you mean 'getenv'?
89 | tgetent(buf, getenv("TERM"));
| ^~~~~~~
| getenv
top.cpp:90:24: error: 'tgetstr' was not declared in this scope; did you mean 'wgetstr'?
90 | exit_ca_mode = tgetstr("te", &entries);
| ^~~~~~~
| wgetstr
top.cpp:97:9: error: 'tputs' was not declared in this scope; did you mean 'puts'?
97 | tputs(save_cursor, 1, putchar);
| ^~~~~
| puts
top.cpp: In function 'void compare(ThreadTimeList*, ThreadTimeList*, bigtime_t, int)':
top.cpp:255:9: error: 'tputs' was not declared in this scope; did you mean 'put'?
255 | tputs(clear_string, 1, putchar);
| ^~~~~
| puts
top.cpp: In function 'int main(int, char**)':
top.cpp:415:9: error: 'tputs' was not declared in this scope; did you mean 'put'?
415 | tputs(exit_ca_mode, 1, putchar);
| ^~~~~
| puts
Still baffled that I can’t just download the source files, compile and voila!
Unless this has something to do with Jam. humdinger pointed out to me in a PM that the jamfile referenced the use of ncurses
:
# standard commands that need libncurses.a
Includes [ FGristFiles top.cpp watch.c ]
: [ BuildFeatureAttribute ncurses : headers ] ;
I know nothing about Jam or jamfile. I took a look at the readme, but still a bit lost. Need to figure out what that is all about and how to use MAKE
with Jam.
I really appreciate the help everybody, this is bolstering my experience and helping me with my coding journey!