Monday, July 19, 2010

PDCurses for MinGW32

As I know MinGW doesn't come with graphic control library, it isn't like borland or turbo which brings conio.h. But you can use curses library for alternative. If you use Linux you can find ncurses library, but if you're windows user you can use PDcurses.

In this tutorial I'll explain how to install PDcurses for MinGW32 compiler in MS Windows. The first things you need are Installed MinGW32 compiler and PDcurses source. You can download MinGW from here and PDcurses from here.

Set up MinGW32
  1. Install MinGW32, don't forget to install 'MinGW make' also (if you don't want to install MSys), in this case I'll install MinGW in C:\MinGW
  2. Set environment path for MinGW bin directory
    • Go to control panel
    • Click System
    • Choose Advanced tab and click "Environment Variables" button
    • Add PATH variable for user, if you have one you can skip this
    • Select PATH variable and Edit
    • In "variable value" text box, add C:\MinGW\bin, and don't forget to use ';' (semicolon) as delimiter
  3. If you didn't install MSys so you need to rename mingw32-make.exe become make.exe
  4. CD C:\MinGW\bin
    RENAME mingw32-make.exe make.exe

Install PDcurses
  1. I assume you have downloaded PDCurses source successfully, in this case I have downloaded PDCurses-3.4.tar.gz
  2. Unpack it by using winrar to C:\ and you will have C:\PDCurses-3.4 directory
  3. Compile win32 PDcurses with DLL
  4. CD C:\PDCurses-3.4\win32
    make -f gccwin32.mak DLL=Y

  5. Copy pdcurses.dll to C:\MinGW\bin
  6. COPY pdcurses.dll C:\MinGW\bin
  7. Copy pdcurses.a to be C:\MinGW\lib\libpdcurses.a
  8. COPY pdcurses.a C:\MinGW\lib\libpdcurses.a
  9. Copy pdcurses header file to C:\MinGW\lib\include
  10. CD ..
    COPY *.h C:\MinGW\include

Test PDcurses
  1. Create test.c
  2. #include <curses.h> int main()
        printw("Hello World !!!\n");
        return 0;

  3. Compile test.c and check if there is any error
  4. gcc test.c -o test -lpdcurses
  5. Test executable file. If you can see "hello world" it means everything goes well
  6. test.exe

I hope this tutorial will be helpful for who need it.



  2. Thanks indeed, couldn't find this anywhere else!

  3. Thank you, I am so glad if this tutorial becomes useful