05. April 2011 · Comments Off on Adding PDCurses to MingW · Categories: Development · Tags: Windows
Last updated on 10/07/2024

This guide illustrates a quick method to add pre-compiled PDCurses to MingW on WinXP and verifying the installation. From time to time, it may be necessary to compile source code in Windows where the NCurses or Curses library is required, and often PDCurses can be used as a substitute. Since PDCurses isn’t included with a MingW installation it must be installed separately. Although other tutorials for installing PDCurses are available, they may contain outdated information, require compiling source code, use overly complex installation instructions, or are specific for various IDEs. This guide uses pre-compiled PDCurses version 3.4 and MingW GCC version 4.50. You can type “gcc –version” (without quotes) at the msys prompt to identify your gcc version.

Background

PDCurses (Pubic Domain Curses) is the multi-platform, public domain implementation of the terminal display library NCurses. NCurses (New Curses) is an implementation of Curses (a play on the term cursor optimization), both of which are terminal control libraries for UNIX and UNIX-like systems. Although not identical, PDCurses, NCurses, and Curses enable programmers to add mouse support, screen painting, colors, key-mapping, windows, and more to text-based applications without regard to the terminal type. An example of PDCurses in use is shown here. MingW (Minimalist GNU for Windows) is a minimal Open Source programming environment for developing Windows native applications not requiring 3rd-party Runtime DLLs. However, MingW does utilize some Microsoft DLLs provided by the Microsoft C runtime library. It includes the GNU Compiler Collection (GCC) and associated tools, the GNU binutils.

Steps

Download the PDCurses version 3.4 file Download pdc34dllw.zip (86.9 KB) from Sourceforge.com and unzip it. This version is the Win32 DLL for console with Unicode. Copy the extracted files to the following folders:

  • pdcurses.lib to MingW’s “/lib” folder
  • curses.h and panel.h to MingW’s “/include” folder
  • pdcures.dll to MingW’s “/bin” folder

Test

Example command using PDCurses to compile the file checkthis.c:

gcc checkthis.c -o checkthis -lpdcurses

If the following code compiles, PDCurses is installed correctly.


/*  checkthis.c  */

#include <curses.h>

int main()

{

initscr();

wclear(stdscr);

printw("hello world\n");

wrefresh(stdscr);

system("pause");

endwin();

}

If you have found a spelling error, please, notify us by selecting that text and pressing Ctrl+Enter.

Share
">Bear

Bad Behavior has blocked 4460 access attempts in the last 7 days.

Spelling error report

The following text will be sent to our editors:

store