ecjb
ecjb

Reputation: 5459

Trouble compile C code containing ncurses library: "Undefined symbols for architecture x86_64:"

I am trying to use the library ncurses on my macos 11.6.1 with the terminal alacritty. When I try to compile this code (copied from there: https://www.viget.com/articles/game-programming-in-c-with-the-ncurses-library/)

// demo.c
#include <ncurses.h>
#include <unistd.h>

int main(int argc, char *argv[]) {

 initscr();
 noecho();
 curs_set(FALSE);

 sleep(1);

 endwin(); // Restore normal terminal behavior
}

, I get the following message:

Undefined symbols for architecture x86_64:
  "_curs_set", referenced from:
      _main in house-efc906.o
  "_endwin", referenced from:
      _main in house-efc906.o
  "_initscr", referenced from:
      _main in house-efc906.o
  "_noecho", referenced from:
      _main in house-efc906.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Does this mean that ncurses is not installed on my system and if yes, how should I instal it?

Upvotes: 0

Views: 25

Answers (0)

Related Questions