I am new to C++ programing and I’m trying to make a program that simulates Conway’s game of life. I’m almost done but when I made each function have it’s own file I keep on getting this linker error.
1>algorithm_change.obj : error LNK2005: "unsigned short height" (?height@@3GA) already defined in algorithm.obj
My code is at https://github.com/rupertsteel/Life/tree/master/Life
Without looking at the code, do you have a global
unsigned short height;in any header file? If yes, replace that withextern unsigned short height;and put aunsigned short height;in a source file that includes the specific header.