How to add ncurses library to project?
Solved
Qt Creator and other tools
-
I am trying to start with ncurses library but QtCreator does not compile it. Here is the simple code:
#include <iostream> #include <ncurses.h> using namespace std; int main(int argc, char *argv[]) { initscr(); /* Start curses mode */ printw("Hello World !!!"); /* Print Hello World */ refresh(); /* Print it on to the real screen */ getch(); /* Wait for user input */ endwin(); /* End curses mode */ return 0; }
I added to .pro file these lines but i could not find where i am doing wrong:
QMAKE_CXXFLAGS += -lncurses QMAKE_CXXFLAGS_DEBUG += -lncurses
When I compile it with g++ manually with -lncurses option it works though. QtCreator gives me undefined reference for those functions.
-
Hi! Your *.pro file should contain:
INCLUDEPATH += /path/to/ncurses/headers/ LIBS += -L/path/to/ncurses/library/ -lncurses