[英]How do I install PDCurses in Windows for use with C++?
我想在我的一些程序中使用它而不是標准的 IOStream。
另外,NCurses 是否在 Windows 上工作,如果是這樣,更好嗎?
下載 zip 文件,將其解壓縮到通常放置外部庫的任何位置,然后檢查自述文件,其中會告訴您以下內容:
PDCurses 已被移植到 DOS、OS/2、Win32、X11 和 SDL。 每個平台都有一個包含特定於端口的源文件的目錄。 構建說明位於每個平台的 README 文件中。
Win32 目錄中的自述文件告訴您有幾個不同編譯器的生成文件。 簡而言之,你運行make
:
make -f
它提到了您可以設置的幾個選項,包括 WIDE 和 UTF8。
要使用該庫,請將包含curses.h的目錄添加到您的包含路徑並鏈接到make
為您生成的pdcurses.lib文件。 如何修改包含路徑和鏈接庫取決於您的開發環境,並且在很大程度上與 PDCurses 無關。
我終於做到了。 首先根據文檔構建/編譯源代碼。
make -f Makefile # did for me, Windows 10
將curses.h
和panel.h
復制到include
文件夾中。 並且,將wincon/pdcurses.a
復制到您的lib
文件夾中。 將pdcurses.a
重命名為libpdcurses.a
。 (因為這是標准)。
現在,您可以包含curses.h
並像這樣編譯它。
g++ main.cpp -lpdcurses
下載PDCurses-master.zip並解壓內容
運行MSYS2 MinGW 64-bit
(或MSYS2 MinGW 32-bit
^1 )
cd
進入wincon
文件夾並運行make -f Makefile WIDE=Y DLL=Y
source
如果您正確地遵循了上述步驟,則wincon
文件夾中應該有 2 個特定文件,名為pdcurses.a
和pdcurses.dll
pdcurses.a
重命名為libpdcurses.a
pdcurses.dll
復制到C:\\msys64\\mingw64\\bin
libpdcurses.a
復制到C:\\msys64\\mingw64\\lib
curses.h
和panel.h
從PDCurses-master
文件夾復制到C:\\msys64\\mingw64\\include
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.