且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 Visual Studio 2017 上安装 pdcurses

更新时间:2023-02-27 15:11:50

我找到了一个 非常有用的网站,它讨论了 PDCurses 及其在 Visual Studio 中的安装.尽管它是 2010/2013 年的,但它在 VS2017 中确实对我有用—甚至是演示程序(有非常细微的变化)!

I have found a very useful website which talks about PDCurses and its installation in Visual Studio. Even though it is for 2010/2013, it really worked for me in VS2017 — even the demo programs (with very minute changes)!

所以这是我做的步骤(因为你已经有了 PDCurses):

So here is the steps I did (since you already have PDCurses):

  1. 以VS2017社区版的开发者命令提示符输入在 set PDCURSES_SRCDIR=;在我的情况下是

set PDCURSES_SRCDIR=C:\pdcurses-master

注意:这里我们设置编译所需的环境变量.如果您需要 pdcurses 库定义的附加功能,您可能需要在此步骤中设置相应的变量.例如,如果您需要宽字符支持,您可以使用set WIDE=1.要查看所有可用选项,您可以在任何文本编辑器中打开 make 文件(在下一步中提到)并查找 if 条件.

Note: Here we are setting up the environment variable needed for compilation. If you need additional functionality defined by the pdcurses library, you may want to set corresponding variables in this step. For example, if you need wide character support, you can use set WIDE=1. To see what all are the options available, you can open up the make file (mentioned in next step) in any text editor and look for if conditionals.

在命令窗口中导航到 PDCurses/win32 目录(在我的例子中是 C:\pdcurses-master\win32)

Navigate in the command window to the directory of PDCurses/win32 (in my case C:\pdcurses-master\win32)

nmake –f vcwin32.mak

(这是 PDCurses 的 make 文件.)它将为我们的 Visual Studio 创建 pdcurses.lib.

(This is the make file for PDCurses.) It will create the pdcurses.lib for our Visual Studio.

现在我们需要将生成的库合并到我们的项目中.因此,打开您的项目并转到项目属性

Now we need to incorporate the generated library into our project. So open up your project and go to project properties

  • 在VC++目录"中,更改:
    • 包含目录:添加一个新的文件路径到 PDCurses 安装目录,在我的例子中是 C:\pdcurses-master.
    • 库目录:添加一个新的文件路径到 PDCurses 安装库目录,在我的例子中是 C:\pdcurses-master\win32.
    • 在代码生成"选项卡中,将运行时库"更改为多线程调试 (/MTd)".(通常已经设置好了)
    • 输入"选项卡中,将pdcurses.lib添加到附加依赖项(我最初很困惑-记住,它是链接器的输入选项卡)
    • In "Input" tab, add pdcurses.lib to Additional Dependencies (I initially got confused - remember, it is the input tab of linker)

    然后哇!我从 pdcurses 项目中运行了一些示例程序(演示),所有这些都为我工作,只需稍作修改.

    Then wow! I ran some sample programs (demos) from the pdcurses project and all of them worked for me with very slight modifications.

    注意:我使用 Visual Studio 2017 创建了一个 Windows(也称为 Win32,如 Win32 API)控制台应用程序并加载了该项目.我确实包含了 stdafx.h 并且编译成功,我能够在终端窗口中看到输出.

    Note: I created a Windows (also known as Win32, as in Win32 API) console application with Visual Studio 2017 and loaded the project. I did include stdafx.h and compilation was successful and I was able to see the output in the terminal window.

    以上网站也提供PDF文件.那里的说明从从网站下载 pdcurses 开始.

    The above website also provides a PDF document too. The instruction there starts from the downloading the pdcurses from website.