【问题标题】:pdcurses installation on Eclipse在 Eclipse 上安装 pdcurses
【发布时间】:2018-04-08 23:38:01
【问题描述】:

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

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

有什么建议吗?

【问题讨论】:

    标签: c++ windows eclipse gcc pdcurses


    【解决方案1】:

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

    设置:

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

    解决方案:

    1. 转到Download 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

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

    测试示例代码:

    #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;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-12-10
      • 2012-07-10
      • 2020-07-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多