简体   繁体   English

C ++控制台ncurses项目-QtCreator在xterm中均不显示任何输出

[英]C++ console ncurses project - QtCreator doesn't show any output in xterm neither in console

#include <ncurses.h>

int main()
{
    initscr();

    addstr("Hello world");
    refresh();
    getch();
    endwin();
    return 0;
}

This basic application doesn't show any output when building and running in QtCreator 2.8.0. 在QtCreator 2.8.0中构建和运行时,此基本应用程序不会显示任何输出。

When i run previously compiled in QtCreator program in separate terminal window, then it works fine. 当我在单独的终端窗口中的QtCreator程序中运行先前编译的文件时,则工作正常。 But when i run it under QtCreator (Ctrl-R or press "Run" button), then i see empty xterm window and no output. 但是,当我在QtCreator(Ctrl-R或按“运行”按钮)下运行它时,我看到空的xterm窗口且没有输出。 I guess this is somehow related with qtcreator_process_stub , which entitles that empty xterm window. 我想这与qtcreator_process_stub有某种关系,它赋予了那个空的xterm窗口。

Try replacing 尝试更换

addstr("Hello world");

with

printw("Hello World !!!");

see 看到

Found a solution. 找到了解决方案。

In Project settings -> Environment -> TERM variable should be set to sane value like xterm 在项目设置->环境-> TERM变量中应将其设置为合理值,例如xterm

By default it was set to dumb 默认情况下它设置为dumb

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM