Can't compile my C program on C9 with #include <ncurses/ncurses.h>


#1

I’m trying to compile this code for a class, but an error is preventing the program from compiling.

This is what I get when I try to compile the program with #include <ncurses/ncurses.h> at the top of the c file:

fatal error: ncurses/ncurses.h: No such file or directory
#include <ncurses/ncurses.h>
^
compilation terminated.

i tried to install: sudo apt-get install libncurses5-dev
and the terminal says:

Reading package lists… Done
Building dependency tree
Reading state information… Done
libncurses5-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 163 not upgraded.

but the program still doesn’t compile.

Please let me know if you know how to resolve this. Thank you.


#2

Hello Rob,

I was unable to link the command to -lncurses
I was able to work around it compiling manually gcc 1.c -o 1.sh -lncurses

Where gcc is the compiler
1.c is the source code
-o 1.sh is the output parameter in this case a executable with the name 1 and the extension .sh
-lncurses is the link command to the library

It compiles in my plain HTML5 workspace also is important to note I run the sudo apt-get install libncurses5-dev command.

Hope this answer your question and is helpful!