I have several classes all of which show the same problem when they compile - "undeclared variable". Needless to say all the variables are, as far as I can tell, declared. The one pattern I seem to be able to find is that the compiler only complains when they are used as parameters. Otherwise the compiler recognizes them.

I won't bore you with the entire code, here's a sample.

Code:
#pragma once
#include <map>
using std::map;
#include <string>
using std::string;
#include <vector>
using std::vector;
#include <algorithm>


class Dictionary
	{
	private:
		vector <TCHAR*> words;
		LONG ref_cnt;
		string module;
		USHORT rsc_id;
		Dictionary (string module, USHORT rsc_id);
		Dictionary (HMODULE module, USHORT rsc_id, LONG key);
		bool FindWord (string searched) 
			{return binary_search (words.begin (), words.end (), searched);}
		static void init_Mutex (void);
	public:
		virtual ~Dictionary (void);
		static LONG LoadDictionary (string module, USHORT rsrc);
		static void UnloadDictionary (LONG key);
		static void UnloadDictionaries (INT size, LONG keys []);
		static bool FindInDictionary (string searched, LONG key);
		static bool FindInDictionaries (string searched, INT size, LONG keys []);
	};
in FindWord words is flagged as undeclared.

Here's one more
Code:
Dictionary::Dictionary(string module, USHORT rsc_id){
	HMODULE hmodule = LoadLibrary (module.c_str ());
	HRSRC rsc = FindResource (hmodule, MAKEINTRESOURCE (rsc_id), RT_RCDATA);
	TCHAR* chWords = (TCHAR*) LoadResource (hmodule, rsc_id);
	
	TCHAR* token = strtok (chWords, "\0");
	TCHAR* new_string = new char [strlen (token)];
	strcpy (new_string, token);
	words.push_back (token);

	while (token = strtok (NULL, "\0")){
		TCHAR* new_string = new char [strlen (token)];
		strcpy (new_string, token);
		words.push_back (new_string);
	}

	FreeLibrary (hmodule);
	this->module = module;
	this->rsc_id = rsc_id;
	InterlockedIncrement (&ref_cnt);
}
Here token is flagged when passed to strcpy (but not strlen or push_back) as is rsc_id when passed to MAEINTRESOURCE and LoadResource.

What's the cause of these errors. They're driving me nuts.