Hello,

I'm currently working on a simple hangman game. I'm running into two problems, first is that in an array which I've labeled static, if I attempt to assign any values I get an unknown symbel error. " ZeroLink: unknown symbol '__ZN7Hangman5WORDSE' ", the program then exits due to signal 6 (SIGABRT). I have absolutely no clue as to what this means.

Secondly, I am attempting to assign values to positions in two arrays, one for correctly guessed characters, and one for incorrect guesses. Somehow it ends up assigning any character that is guessed to both arrays. I have gone through the code a number of times and cannot see any logic errors. I'm reduced to thinking that it must be one of the "perks" of c++ that I am missing. ^_^

I've included the following code, the first is the header file, and the second/third are the only methods which actually affect values.

My background is primarily Java and basics so that may explain some mistakes you may see ^_^;;.

Thank you,

Norehsa

Code:
/* Hangman.h */

#ifndef HANG_H
#define HANG_H
#include <iostream>
#include <string>
#include <cstdlib>
class Hangman{
private:
	static std::string WORDS[3];
	std::string word;
	char guessG[];
	char guessB[7];
	int  bguess;
	bool gameWon();
	bool gameLost();
	bool gameOver();
	void handleGuess(char);
	void printHangman(int);
public:
	Hangman();
	~Hangman();
	void playGame();
};

#endif
Constructor
Code:
Hangman::Hangman(){
	//The bug is in the following three assignment statements.
	//WORDS[0] = "hello";
	//WORDS[1] = "cat";
	//WORDS[2] = "digg";
	//word = WORDS[rand()%2];	
	word = "cat";
	//prepare the good guess section.
	for(int i = 0; i<word.length(); i++){
		guessG[i] = '_';
	}
	//prepare the bad guess section.
	bguess = 0;	
	for(int i=0; i<7; i++){
		guessB[i] = '_';
	}
		
}
This is the method that places a guess into the array for correct guesses (guessG) or incorrect guesses (guessB). I've included the header to clarify a bit.

Code:
/**
* handleGuess
 *
 * If the guessed letter (parameter ch) is in the secret word
 * then add it to the array of correct guesses and tell the user
 *      that the guess was correct;
 * otherwise, add the guessed letter to the array of incorrect guesses
 *      and tell the user that the guess was wrong.
 *
 * @param ch the guessed letter
 */

void Hangman::handleGuess(char ch) {
	bool wasIn = false;
	for(int i=0; i<word.length(); i++){
		if(word[i] == ch){		
			guessG[i] = ch;
			wasIn = true;
		}
	}
	if(!wasIn){
		guessB[bguess] = ch;
		bguess++;
	}
}