Problems with curses library

Hello. I'm trying to put some colors in my output but when I run the C program it fails to build. Could anyone explain me what's causing all these errors? https://imgur.com/a/ESQII

this is the code:


#include <curses.h>

#include <stdio.h>

int main() {

initscr();

start_color();


init_pair(1, COLOR_BLACK, COLOR_RED);

init_pair(2, COLOR_BLACK, COLOR_GREEN);


attron(COLOR_PAIR(1));

printw("This should be printed in black with a red background!\n");


attron(COLOR_PAIR(2));

printw("And this in a green background!\n");

refresh();


getch();


endwin();

}


thanks in advance. 😀

You need to link your app with

libncurses
(or
libcurses
if you’re feeling old school). So:
  1. In the project navigator on the left, select your project.

  2. In the project editor, select your target.

  3. Select the Build Phases tab.

  4. Click the triangle next to Link Binary With Libraries to disclose the list of libraries you link to.

  5. Click the add (+) button.

  6. Enter “curses” into the search field.

  7. Select

    libncurses.tbd
    (this is a stub library) and click Add.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Problems with curses library
 
 
Q