PDA

View Full Version : How to add the ncurses.h to a C++ program compiled on gcc



padfootpak
August 31st, 2011, 07:20 PM
I am totally new to C++ programming on gcc. I wanted to add color to my text on the output to the console. Since there is no conio.h on linux, I researched and found that ncurses.h could do the trick. Now the only problem is that I do not know how to download it and then add the library. Can someone please describe the method?

Also, if anybody can describe whether ncurses.h is a better option than curses.h or if I am completely wrong in using curses.h?

Bachstelze
August 31st, 2011, 07:37 PM
If all you want is colored output, you don't need curses, just use the ANSI color codes.

http://en.wikipedia.org/wiki/ANSI_escape_code#Colors

Smart Viking
August 31st, 2011, 07:50 PM
Also, if anybody can describe whether ncurses.h is a better option than curses.h or if I am completely wrong in using curses.h?

I am of the understanding that curses.h and ncurses.h on most GNU/Linuxt systems are the same files, curses.h added for compability with older programs:

$ diff /usr/include/ncurses.h /usr/include/curses.h
$Correct me if I'm wrong.