1

我在安装这个库时遇到了一些麻烦。我的设置是:

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

我下载pdc34dllw.zip并将所有内容解压缩到一个新的 Eclipse C/C++ 项目中。所以在我的项目中,我有:

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

设置 Eclipse 项目:

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 内容:

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

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

    return(0);
}

当我尝试编译时出错:

找不到 -pdcurses

有什么建议么?

4

1 回答 1

1

好的,一天后,我找到了解决问题的方法。我们到了:

环境:

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

解决方案:

  1. 下载 PdCurses
  2. C:\在(或某处)提取它
  3. 打开提示并写入cd C:\Pdcurs34(如果您将提取的目录放在 C 中:)
  4. 然后cd win32
  5. 如果你使用 MinGW 写

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

  6. 转到 Eclipse 并创建新项目

  7. 右键单击项目并转到属性

  8. 转到C/C++ Build左侧菜单

  9. 转到Settings并选择Tool Settings选项卡

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

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

  12. 输入MinGW C++ Linker->Libraries (-l)输入pdcurses

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

  14. 单击确定并关闭项目属性

  15. 创建 main.cpp

  16. 粘贴我在此列表下方编写的代码

  17. 构建项目

  18. 您无法使用 Eclipse 控制台查看 pdcurses 输出(您无法从 Eclipse 运行程序),因此再次打开 Windows Prompt 并进入您的项目目录,然后编写cd Debug

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

  20. 从提示运行(或单击项目.exe)您的project_name.exe

一切都应该没问题。请记住始终在项目目录中有一个pdcurses.dll文件Debug。对我来说,这很有效,我希望对你也一样。

测试示例代码:

#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;
}
于 2017-10-27T18:51:29.277 回答