Fri. Feb 28th, 2020

Host your Website

Read and learn

Ncurses and C++ 1 – hello world (for Linux!)

1 min read

In this video tutorial (which actully the first in a series) I would like to tell you the basics of the ncurses and write the hello world program with ncurses too.
Ncurses is a library for Linux we can use it to manipulate the terminal, so move to a specific coordinate, write out something there, get a character, use colors and so on.
The end of this series we’ll write an old-stylish (characteric) snake game.
A good site, where you can get more information:


16 thoughts on “Ncurses and C++ 1 – hello world (for Linux!)

  1. Compiling with `g++ ncurses-test.cpp -o nctest -lncurses` results in the error `fatal error: ncurses.h: No such file or directory`. I tried changing the <> to "" in the include directive and it still can't find the directory, yet `whereis` tells me ncurses.h is located in /usr/lib/ncurses. What's the problem?

  2. That's a linker error, and it happens, because your compiler doesn't find the library file for ncurses. If you're using command line (g++) to compile your program, compile it like this:
    g++ main.cpp -lncurses (as you see at 6:00)
    If you are using some IDE (like Code::Blocks), you can add the -lncurses in the project/build options->linker settings (first input) or you can browse your lib file libncurses.a (or files (second input)

  3. I installed the ncurses-dev package, and compiled the program, but I'm getting a bunch of errors, like "undefined reference to `initscr'" and "undefined reference to `printw'" and stuff! Does anyone know what the problem is? Help please!

Comments are closed.

Copyright © All rights reserved. | Newsphere by AF themes.