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
- 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
- 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
- If you didn't install MSys so you need to rename mingw32-make.exe become make.exe
CD C:\MinGW\bin
RENAME mingw32-make.exe make.exe
Install PDcurses
- I assume you have downloaded PDCurses source successfully, in this case I have downloaded PDCurses-3.4.tar.gz
- Unpack it by using winrar to C:\ and you will have C:\PDCurses-3.4 directory
- Compile win32 PDcurses with DLL
- Copy pdcurses.dll to C:\MinGW\bin
- Copy pdcurses.a to be C:\MinGW\lib\libpdcurses.a
- Copy pdcurses header file to C:\MinGW\lib\include
CD C:\PDCurses-3.4\win32
make -f gccwin32.mak DLL=Y
COPY pdcurses.dll C:\MinGW\bin
COPY pdcurses.a C:\MinGW\lib\libpdcurses.a
CD ..
COPY *.h C:\MinGW\include
Test PDcurses
- Create test.c
- Compile test.c and check if there is any error
- Test executable file. If you can see "hello world" it means everything goes well
#include <curses.h>
int main()
{
initscr();
printw("Hello World !!!\n");
refresh();
system("pause");
endwin();
return 0;
}
gcc test.c -o test -lpdcurses
test.exe
I hope this tutorial will be helpful for who need it.
THANK YOU VERY MUCH MY FRIEND !!
ReplyDeleteThanks indeed, couldn't find this anywhere else!
ReplyDeleteThank you, I am so glad if this tutorial becomes useful
ReplyDelete