I am learning for fun with building my own matrix and im on my Mac is the only computer I have and I dont want to go through Virtual environment just to play around with matrix on Mac. Is there a way or no is what I will like to find out.
int
main(int argc, char **argv) {
if (!init_ui()) {
return EXIT_FAILURE;
}
matrix_init();
for (int i = 0; i < ITERATIONS; i++) {
matrix_update();
show_matrix();
usleep(REFRESH_DELAY);
}
return EXIT_SUCCESS;
}
Here is the init_ui() function
bool init_ui() {
//set the matrix all to black
//move this later to matrix.c
for (int x = 0; x < MAXX; x++) {
for (int y = 0; y < MAXY; y++) {
matrix[x][y].char_value = 0;
matrix[x][y].char_value = 0;
}
}
//init curses
uiwindow = initscr();
if (uiwindow == NULL) return false;
start_color();
if (!has_colors() || !can_change_color() || COLOR_PAIRS < 6) {
printf("Warning. Your terminal can't handle this program.\n");
return false;
}
set_colors();
return true;
}//end bool
Error :
clang -Wall -g main.o matrix.o ui.o -o mainapp
Undefined symbols for architecture x86_64:
"_COLOR_PAIRS", referenced from:
_init_ui in ui.o
"_can_change_color", referenced from:
_init_ui in ui.o
"_delwin", referenced from:
_cleanup_ui in ui.o
"_endwin", referenced from:
_cleanup_ui in ui.o
"_has_colors", referenced from:
_init_ui in ui.o
"_init_color", referenced from:
_set_colors in ui.o
"_init_pair", referenced from:
_set_colors in ui.o
"_initscr", referenced from:
_init_ui in ui.o
"_start_color", referenced from:
_init_ui in ui.o
"_stdscr", referenced from:
_cleanup_ui in ui.o
_show_matrix in ui.o
"_waddch", referenced from:
_show_matrix in ui.o
"_wcolor_set", referenced from:
_show_matrix in ui.o
"_wmove", referenced from:
_show_matrix in ui.o
"_wrefresh", referenced from:
_cleanup_ui in ui.o
_show_matrix in ui.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mainapp] Error 1
The init_ui() is not the only the problem here. I mean I fell in love with c so I can't stop coding in c even though I mastered python but c just took my attention. So idk I would love to know more than just write boring code