C programming: Setup PDcurses library with ease on Windows

Setup PDcurses on Windows

Sometimes (most of times) setup some libs on Windows can be such a pain in the ass, in fact today I’ll explain you how to easily setup PDcurses library on Windows, using Dev-cpp.

Of course the steps below could be reproduced on every other ide.

What’s curses (on Windows we have PDcurses)?

It’s a useful display manager, it allows you to take full control of characters on the screen, write text wherever you want, with whatever color or effect you want. You can do tons of stuff with it, here is the official doc page link.

HOW TO INSTALL

  • Install an ide on your windows machine, I’ll use the simple Dev-Cpp.
  • Download this zip containing the files you’ll need.
  • Create a folder called pdcurses and another one called include, inside of it.
  • Extract panel.h and curses.h in the include fold.
  • Extract the .dll file in the pdcurses one.
  • Now open your ide and set the 32-bit version compiler as the default one.
  • Create a new project, set it up.
  • On the lefty Treeview, right click on the project icon -> project options
  • Go to -> Parameters¬† tab-> Linker -> insert in its box the path to the .dll file you extracted before
  • Go to -> Files/folders tab
  • Here you’ll see three inner tabs named: Libraries/Includes/resources folders; inside each of them you have to insert the path to the include folder you created before.

Like this:

curses

Click ok and to test if everything went good, write and compile/exec this:

#include <stdio.h>
#include <curses.h>

int main(){
    // initialize curses, print at pos (3,3) "hello curses!" and refreshes
       the screen
    initscr();
    mvprintw(3,3, "Hello curses!");
    wrefresh(stdscr);

    getch();
    return 0;
}

If you correctly followed all the steps, this should have been correctly compiled/executed.

For any problems, request, use the comment box below!

Lascia un commento