C++ Referencing an Object from a global static function <p>I have a globally declared static function that needs to reference an object, but when I do so, I get an "undeclared identifier" error.</p> <p>Here is a sample of my code</p> <pre><code>#pragma once #include "stdafx.h" #include &lt;vector&gt; #include "Trigger.h" using namespace std; namespace Gamma_Globals { static vector&lt;void*&gt; gvTriggers; } static LPARAM CALLBACK ProgramWndProc(HWND, UINT, WPARAM, LPARAM); static LPARAM CALLBACK ProgramWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_KEYUP: { for (int i = 0; i &lt; Gamma_Globals::gvTriggers.size(); i++) { Trigger t = Gamma_Globals::gvTriggers[i]; } } default: return DefWindowProc(hWnd, uMsg, wParam, lParam); break; } return 0; } </code></pre> <p>The issue comes in the WM_KEYUP case, when I tried to set "Trigger t", I get the error "'Trigger' : undeclared identifier." What can I do to reference the Trigger object from ProgramWndProc?</p> <p>Thanks!</p> <hr> <p>As requested, here is a copy of Trigger.h</p> <pre><code>#pragma once #include "Noun.h" #include "TermFactory.h" #include "Globals.h" using namespace std; class Trigger { public: enum TRIGGER_TYPE {NONE, ONKEYPRESS, ONMOUSEPRESS}; Trigger(void*); Trigger(LPTSTR trigger, LPTSTR action, Gamma_Globals::TRIGGER_TIME); ~Trigger(void); VOID Perform(); TRIGGER_TYPE GetType(); private: LPTSTR lpCondition; LPTSTR lpAction; Gamma_Globals::TRIGGER_TIME triggerTime; vector&lt;Noun*&gt; vNouns; TRIGGER_TYPE triggerType; VOID LoadAction(LPTSTR Action); HRESULT LoadCondition(LPTSTR Condition); }; </code></pre>