I know this is similar to a bunch of other undefined static reference questions, but in this one I can see that the "undefined" static variable is defined.
I have several errors like this. Here's a sample of my code:
gmcharacter.h:
const string GMCHARACTER("character");
class GameCharacter : public GamePart
{
private:
string name;
static vector<GameCharacter*> characterList;
public:
GameCharacter(cstring nm, cstring id) :
GamePart(GMCHARACTER, id, TRUE, TRUE, TRUE),
name(nm)
{ }
...
}
gamecharacter.cpp
vector<GameCharacter*> characterList;
...
make output:
g++ -DYYERROR_VERBOSE -Wall -std=c++11 -g -MT gamecharacter.o -MMD -MP -MF .d/gamecharacter.Td -save-temps **-c -o gamecharacter.o gamecharacter.cpp**
g++ -o ../mkscript -lstdc++ -g gamepart.o **gamecharacter.o** gamecondition.o gamedoor.o gameroom.o gamething.o gamedot.o gamemap.o gameoption.o condflag.o game.o flaglist.o IDList.o imagedesc.o lexer.o mkscript.o util.o commandargs.o PHPWriter.o ASWriter.o PHPArgumentList.o ASArgumentList.o gh1.tab.o
/usr/lib/gcc/x86_64-pc-cygwin/9.3.0/../../../../x86_64-pc-cygwin/bin/ld: gamecharacter.o:gamecharacter.cpp:(.rdata$.refptr._ZN13GameCharacter13characterListE[.refptr._ZN13GameCharacter13characterListE]+0x0): **undefined reference to `GameCharacter::characterList'**