I think its a linker error , but I am new to programming and I don't know what to do I am using four functions in this program , I am sorry I can't provide the whole code but I have provided the inbuilt functions of ncurses that I have used in this program please help , if I need to link any Library pls tell me how to do that
program :
#include <cstdlib>
#include <ncurses.h>
#include <unistd.h>
void Initialize()
{
initscr();
clear();
noecho();
cbreak();
curs_set(0);
}
void Render()
{
clear();
refresh();
}
void Poll_Input()
{
keypad(stdscr, TRUE);
halfdelay(1);
int c = getch();
switch(c)
{
case KEY_LEFT:
dir = LEFT;
break;
case KEY_RIGHT:
dir = RIGHT;
break;
case KEY_DOWN:
dir = UP;
break;
case KEY_UP:
dir = DOWN;
break;
case KEY_EXIT:
gameOver = true;
break;
}
}
void Update()
{
}
int main(void)
{
Initialize();
while(!gameOver)
{
Render();
Poll_Input();
Update();
}
getch();
sleep(1);
endwin();
return 0;
}
output :
Undefined symbols for architecture arm64:
"_cbreak", referenced from:
Initialize() in snakegame-8f6819.o
"_clear", referenced from:
Initialize() in snakegame-8f6819.o
Render() in snakegame-8f6819.o
"_curs_set", referenced from:
Initialize() in snakegame-8f6819.o
"_endwin", referenced from:
_main in snakegame-8f6819.o
"_halfdelay", referenced from:
Poll_Input() in snakegame-8f6819.o
"_initscr", referenced from:
Initialize() in snakegame-8f6819.o
"_keypad", referenced from:
Poll_Input() in snakegame-8f6819.o
"_mvprintw", referenced from:
Render() in snakegame-8f6819.o
"_noecho", referenced from:
Initialize() in snakegame-8f6819.o
"_refresh", referenced from:
Render() in snakegame-8f6819.o
"_stdscr", referenced from:
Poll_Input() in snakegame-8f6819.o
_main in snakegame-8f6819.o
"_wgetch", referenced from:
Poll_Input() in snakegame-8f6819.o
_main in snakegame-8f6819.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)