[英]How do I install PDCurses in Windows for use with C++?
I want to use it in some of my programs instead of the standard IOStream.我想在我的一些程序中使用它而不是标准的 IOStream。
Also, does NCurses work on Windows, and if so, any better?另外,NCurses 是否在 Windows 上工作,如果是这样,更好吗?
Download the zip file , unpack it wherever you typically put external libraries, and check the readme, which tells you the following:下载 zip 文件,将其解压缩到通常放置外部库的任何位置,然后检查自述文件,其中会告诉您以下内容:
PDCurses has been ported to DOS, OS/2, Win32, X11 and SDL.
PDCurses 已被移植到 DOS、OS/2、Win32、X11 和 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.
构建说明位于每个平台的 README 文件中。
The readme file in the Win32 directory tells you that there are makefiles for several different compilers. Win32 目录中的自述文件告诉您有几个不同编译器的生成文件。 In short, you run
make
:简而言之,你运行
make
:
make -f makefilename
It tells mentions a couple of options you can set, including WIDE and UTF8.它提到了您可以设置的几个选项,包括 WIDE 和 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.要使用该库,请将包含curses.h的目录添加到您的包含路径并链接到
make
为您生成的pdcurses.lib文件。 How you modify your include path and your linked libraries depends on your development environment and is largely irrelevant to PDCurses.如何修改包含路径和链接库取决于您的开发环境,并且在很大程度上与 PDCurses 无关。
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.将
curses.h
和panel.h
复制到include
文件夹中。 And, Copy wincon/pdcurses.a
into your lib
folder.并且,将
wincon/pdcurses.a
复制到您的lib
文件夹中。 Rename pdcurses.a
to libpdcurses.a
.将
pdcurses.a
重命名为libpdcurses.a
。 (Because it's the standard). (因为这是标准)。
Now, You can include curses.h
and compile it like this.现在,您可以包含
curses.h
并像这样编译它。
g++ main.cpp -lpdcurses
Download PDCurses-master.zip and extract the content下载PDCurses-master.zip并解压内容
Run MSYS2 MinGW 64-bit
(or MSYS2 MinGW 32-bit
^1 )运行
MSYS2 MinGW 64-bit
(或MSYS2 MinGW 32-bit
^1 )
cd
into the wincon
folder and run make -f Makefile WIDE=Y DLL=Y
source cd
进入wincon
文件夹并运行make -f Makefile WIDE=Y DLL=Y
source
If you followed the steps above so far correctly, there should be 2 specific files inside wincon
folder called pdcurses.a
and pdcurses.dll
如果您正确地遵循了上述步骤,则
wincon
文件夹中应该有 2 个特定文件,名为pdcurses.a
和pdcurses.dll
pdcurses.a
to libpdcurses.a
pdcurses.a
重命名为libpdcurses.a
pdcurses.dll
into C:\\msys64\\mingw64\\bin
pdcurses.dll
复制到C:\\msys64\\mingw64\\bin
libpdcurses.a
into C:\\msys64\\mingw64\\lib
libpdcurses.a
复制到C:\\msys64\\mingw64\\lib
curses.h
and panel.h
form PDCurses-master
folder into C:\\msys64\\mingw64\\include
curses.h
和panel.h
从PDCurses-master
文件夹复制到C:\\msys64\\mingw64\\include
Install the C/C++ extension安装C/C++ 扩展
Follow those steps to create a working enviroment inside VSCode按照这些 步骤在 VSCode 中创建一个工作环境
Add "-lpdcurses"
under "args":
into tasks.json
在
"args":
下添加"-lpdcurses"
"args":
到tasks.json
and you are Done (at least those steps worked for me)你已经完成了(至少这些步骤对我有用)
g++ your_example.c -o your_example -lpdcurses
inside MSYS2 MinGW 64-bit
terminal if you want so [...]MSYS2 MinGW 64-bit
终端中运行g++ your_example.c -o your_example -lpdcurses
手动构建示例 [...]{
"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
}
{
// 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": [
{
"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"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.