BossShell
BossShell

Reputation: 389

pdcurses installation on Eclipse

I have some troubles in installing this lib. My settings is:

Eclipse Version: Neon.3 Release (4.6.3)
MinGW-w64 - for 32 and 64 bit Windows

I download pdc34dllw.zip and I extracted all into a new Eclipse C/C++ project. So in my project I have:

main.cpp
panel.c
curses.h
pdcurses.dll
pdcurses.lib

Setting Eclipse Project:

GCC C++ Compiler -> Includes -> "${workspace_loc:/${ProjName}}"
GCC C Compiler -> Includes  -> "${workspace_loc:/${ProjName}}"
MinGW C++ Linker -> Libraries (-l) -> pdcurses
MinGW C++ Linker -> Libraries search Path (-L) -> "${workspace_loc:/${ProjName}}"

main.cpp content:

#include <iostream>
#include "curses.h"
using namespace std;

int main() {
    initscr();
    wclear(stdscr);
    printw("hello world\n");
    wrefresh(stdscr);
    system("pause");
    endwin();

    return(0);
}

Error when i try to compile:

Cannot find -pdcurses

Any suggestions?

Upvotes: 1

Views: 725

Answers (1)

BossShell
BossShell

Reputation: 389

Ok, after a day I found a solution to my problem. Here we are:

Setting:

Eclipse Version: Neon.3 Release (4.6.3)
MinGW-w64 

Solution:

  1. Go to Download PdCurses
  2. Extract It in C:\ (or somewhere)
  3. Open Prompt and write cd C:\Pdcurs34 (if you put the extracted dir in C:)
  4. Then cd win32
  5. If you use MinGW write

    mingw32-make -f mingwin32.mak WIDE=Y UTF8=Y DLL=Y

  6. Go to Eclipse and create new project

  7. Right click on the project and go to properties

  8. Go to C/C++ Build on the left menu

  9. Go to Settings and select Tool Settings tab

  10. In GCC C++ Compiler -> Includes -> Include paths (-l) put "C:\pdcurs34"

  11. In GCC C Compiler -> Includes -> Include paths (-l) put "C:\pdcurs34"

  12. In MinGW C++ Linker -> Libraries (-l) put pdcurses

  13. In MinGW C++ Linker -> Library search path (-L) put C:\pdcurs34\win32

  14. Click ok and close project properties

  15. Create main.cpp

  16. Paste the code I write below this list

  17. Build project

  18. You can't use the Eclipse console to see pdcurses output (you can't run your program from Eclipse), so open again Windows Prompt and go into your project directory, then write cd Debug

  19. write cp C:\pdcurs34\win32\pdcurses.dll your_project_directory\Debug

  20. run from the Prompt (or click the project .exe) your project_name.exe

Everything should be fine. Remember always to have a pdcurses.dll file inside the Debug directory of your project. For me this worked, I hope it will be the same for you.

Sample code for test:

#include <iostream>
#include <curses.h>
using namespace std;

int main(){
    initscr();          /* Start curses mode          */
    printw("Hello World !!!");  /* Print Hello World          */
    refresh();          /* Print it on to the real screen */
    getch();            /* Wait for user input */
    endwin();
    return 0;
}

Upvotes: 1

Related Questions