So, in trying to add a new global variable to keep track of the last color used by the MUD, but I've run into a bit of an issue. The code itself compiles, up until the very end when I receive this error message:
$make -s smaug Compiling o/color.o…. o/color.o: In function `_Z11set_lastcolPc': …/quarulid/src/color.c:1878: undefined reference to `_last_col' …/quarulid/src/color.c:1884: undefined reference to `_last_col' collect2: ld returned 1 exit status make[1]: *** [smaug] Error 1 make: *** [all] Error 2
What "extern char last_col[2];" means to the compiler is that there exists a variable called last_col somewhere. It doesn't define it.
22 Oct, 2010, Bobo the bee wrote in the 3rd comment:
Votes: 0
And, yep, this was indeed the problem. Not being used to larger-scale programs, I keep forgetting that setting something in a header file doesn't mean it exists as of yet. A simple error, and thanks for pointing it out. To any who might wonder, a declaration of
So, in trying to add a new global variable to keep track of the last color used by the MUD, but I've run into a bit of an issue. The code itself compiles, up until the very end when I receive this error message:
However, in mud.h I certainly have this:
The code the uses last_col is: