5

I want to use it in some of my programs instead of the standard IOStream.

Also, does NCurses work on Windows, and if so, any better?

genpfault
  • 51,148
  • 11
  • 85
  • 139
user1212347
  • 63
  • 1
  • 2
  • 4
  • 1
    I'm not sure which IDE you use, but for Visual Studio this is a good guide: https://stackoverflow.com/questions/42708392/install-pdcurses-on-visual-studio-2017 – Letokteren Jul 12 '17 at 20:14

3 Answers3

5

Download the zip file, unpack it wherever you typically put external libraries, and check the readme, which tells you the following:

PDCurses has been ported to DOS, OS/2, Win32, X11 and SDL. A directory containing the port-specific source files exists for each of these platforms. Build instructions are in the README file for each platform.

The readme file in the Win32 directory tells you that there are makefiles for several different compilers. In short, you run make:

make -f makefilename

It tells mentions a couple of options you can set, including WIDE and UTF8.

To then use the library, add the directory that contains curses.h to your include path and link with the pdcurses.lib file that make generates for you. How you modify your include path and your linked libraries depends on your development environment and is largely irrelevant to PDCurses.

Rob Kennedy
  • 161,384
  • 21
  • 275
  • 467
  • For me, the readme says: PDCurses Portable Core ====================== This directory contains core PDCurses source code files common to all platforms. Building -------- These modules are built by the platform-specific makefiles, in the platform directories. Distribution Status ------------------- The files in this directory are released to the Public Domain. Acknowledgements ---------------- The panel library was originally provided by Warren Tucker – Evorlor Feb 28 '15 at 03:17
  • OK, @Evorlor. That seems to say pretty much the same thing, no? Was there something you meant to add to this? – Rob Kennedy Feb 28 '15 at 03:46
  • guess not. i thought i was making the point that it doesnt tell u how to install PDCurses. But i guess i was making the point that i just dont understand it – Evorlor Feb 28 '15 at 03:48
  • After 3 hours, I gave up on PDCurses. Now I am just trying to Console::SetCursorPosition(int, int);, but I can't even seem to get that working :-/ – Evorlor Feb 28 '15 at 03:51
  • 2
    @Evorlor Idk if this will help you, but the instructions here [PDCurses MinGW tutorial](http://comptb.cects.com/adding-pdcurses-to-mingw/) helped me to install PDCurses for my C application using MinGW. – chenshuiluke Sep 13 '15 at 17:29
2

On VSCode

[Step 1] Install MinGW :

  • MinGW installation steps
  • ^(make sure you followed the steps carefully)

[Step 2] BUILD PDCurses:

  • Download PDCurses-master.zip and extract the content

  • Open\Run MSYS2 MinGW 64-bit (or MSYS2 MinGW 32-bit^1)

  • cd into the wincon folder and run make -f Makefile WIDE=Y DLL=Y source

[Step 3] Copy Files:

If you followed the steps above so far correctly, there should be 2 specific files inside wincon folder called pdcurses.a and pdcurses.dll

  • rename pdcurses.a to libpdcurses.a
  • copy pdcurses.dll into C:\msys64\mingw64\bin
  • copy libpdcurses.a into C:\msys64\mingw64\lib
  • copy curses.h and panel.h form PDCurses-master folder into C:\msys64\mingw64\include

[Step 4] Build an example:

  • Install the C/C++ extension

  • Follow those steps to create a working enviroment inside VSCode

  • Add "-lpdcurses" under "args": into tasks.json

  • and you are Done (at least those steps worked for me)

Extra

  • you can also just manually build an example by runing g++ your_example.c -o your_example -lpdcurses inside MSYS2 MinGW 64-bit terminal if you want so [...]
  • ^1 if you want to build for 32 systems a good rule is to follow all steps above but wherever you see 64 replace it with 32
  • demos / examples

how things should look like:

enter image description here

  • c_cpp_properties.json
{
    "configurations": [
        {
            "name": "Win64",
            "includePath": [
                "${default}"
            ],
            "windowsSdkVersion": "10.0.17763.0",
            "compilerPath": "C:/msys64/mingw64/bin/g++.exe",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "${default}"
        }
    ],
    "version": 4
}
  • launch.json
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "g++.exe - Build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\msys64\\mingw64\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: g++.exe build active file"
        }
    ]
}
  • tasks.json:
{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe build active file",
            "command": "C:\\msys64\\mingw64\\bin\\g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe",
                "-lpdcurses"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}
Giorgos Xou
  • 1,461
  • 1
  • 13
  • 32
1

I finally made it. First Build/Compile the Source according to docs.

make -f Makefile # did for me, Windows 10

Copy curses.h and panel.h into your include folder. And, Copy wincon/pdcurses.a into your lib folder. Rename pdcurses.a to libpdcurses.a. (Because it's the standard).

Now, You can include curses.h and compile it like this.

g++ main.cpp -lpdcurses
Appaji Chintimi
  • 613
  • 2
  • 7
  • 19