Sep 02, 2019 The GNU Compiler Collection (GCC) is an open-source collection of compilers and libraries supporting C, C, and other programming languages. This tutorial explains how to install install the GCC compiler on Debian 10 Buster. Mar 01, 2018 In this tutorial I show you how to install C / C and NetBeans on both Windows and MacOS. I decided to use NetBeans because I think it is the best C.
I need to compile an application with ncurses library and header files. How do I install install ncurses libs and header files on a Linux operating system? How do I write a simple hello world program using the ncurses and compile it on a Linux?GNU ncurses is software API for controlling writing to the console screen under Unix, Linux and other operating systems. You can create text-based user interfaces (TUI) on a Linux or Unix-like system using ncurses library. [donotprint][/donotprint]
Advertisements
Installing the ncurses library in Debian/Ubuntu Linux
- You need to install the following two packages:
libncurses5-dev : Developer’s libraries for ncurses
libncursesw5-dev : Developer’s libraries for ncursesw - Open the Terminal application.
- Type the following apt-get command to install ncurses header and libs:
sudo apt-get install libncurses5-dev libncursesw5-dev
Sample outputs:
Installing the ncurses library in CentOS/RHEL/Scientific Linux 6.x/7.x+ and Fedora Linux 21 or older
- You need to install the following package:
ncurses-devel : Developer's libraries for ncurses - Open the Terminal application.
- Type the following yum command to install ncurses header and libs:
sudo yum install ncurses-devel
Sample outputs:
Installing the ncurses library in Fedora Linux 22.x+
- You need to install the following package:
ncurses-devel : Developer's libraries for ncurses - Open the Terminal application.
- Type the following dnf command to install ncurses header and libs:
sudo dnf install ncurses-devel
How do compile C program and use the ncurses library?
Create a test program called hello.c as follows:
First, make sure you install GNU/GCC C compiler on a Linux:
To link to the ncurses library pass the -lncurses option to gcc/cc command:
Run it:
Sample outputs:
$ cc -o output input.c -lncurses
$ cc -o hello hello.c -lncurses
Run it:
$ ./hello
Sample outputs:
Here is another program:
Compile and run it as follows:
Sample outputs:
$ cc -o curwin1 curwin1.c -lncurses
$ ./curwin1
Sample outputs:
See this page and GNU ncurses project home page for more information.
This entry is 10 of 13 in the Linux GNU/GCC Compilers Tutorial series. Keep reading the rest of the series:Debian
- How To Install ncurses Library on a Linux
Dev Cpp Install
ADVERTISEMENTS