title: c++ Writing callback function in file.h and file.cpp
body: <p>I need to write a callback function because I will be using the following function:</p>
  
  <pre><code>EnumChildWindows(windowHandle, EnumChildProc, 0);
  </code></pre>
  
  <p>where the second variable "EnumChildProc" needs to be a callback function.</p>
  
  <p>The problem is that I am having difficulties when writing the function in both the header and source file. Normally when I write a boolean function or any other type, I would first delcare it in the header the following way:</p>
  
  <pre><code>bool myFunction(int var1);
  </code></pre>
  
  <p>and if the previous file was in file.h, I would then write the following code in the source file:</p>
  
  <pre><code>bool file::myFunction (int var1)
  {
    ///here would be my code
  }
  </code></pre>
  
  <p>but with a callback function I tried doing the following and it didn't work:</p>
  
  <p>in the file.h:</p>
  
  <pre><code>BOOL CALLBACK EnumChildProc(HWND windowHandle, LPARAM lParam);
  </code></pre>
  
  <p>in the file.cpp:</p>
  
  <pre><code>BOOL file::CALLBACK EnumChildProc(HWND windowHandle, LPARAM lParam)
  {
     ///code goes here
  }
  </code></pre>
  
  <p>It doesnt work because I get the following error:</p>
  
  <pre><code>error: expected unqualified-id before '__attribute__'
  </code></pre>
  
  <p>and the error refers to the following line in the source code:</p>
  
  <pre><code>BOOL programLoop::CALLBACK EnumChildProc(HWND windowHandle, LPARAM lParam)
  </code></pre>
  
  <p>any ideas what I am doing wrong? I don't know if I am doing something wrong when I declare the callback function in the header or source file or somewhere... what do you guys think?</p>