title: Returning a pair type in C++ function prevents complation
body: <p>I have a function in C++ with the following header:</p>
  <pre><code>int DECLSPEC __cdecl HandleUpdate(uint8_t* MessageBuffer, uint32_t MessageLength );
  </code></pre>
  <p>However, I do not want this function to return an <code>int</code>, I now need it to return a <code>std::pair&lt;uint8_t*, uint32_t&gt;*</code>.</p>
  <p>Changing <strong>literally only the return type</strong> (and adding the return value in the function) in the <code>.h</code> and <code>.cpp</code> file throws these errors, despite the code compiling correctly when the return type is a standard type (<code>int</code>, <code>bool</code>, <code>void</code>):</p>
  <pre><code>//all of these errors pertain to the code snippets I have made available
  
  error C2059: syntax error: '__declspec(dllexport)'                 //on the declaration in the header file
  error C2238: unexpected token(s) preceding ';'                     //on the declaration in the header file
  error C2059: syntax error: '__declspec(dllexport)'                 // on `std` in the return type in the .cpp file
  error C2039: 'HandleUpdate': is not a member of 'EACServer'        //in the .cpp file
  error C2143: syntax error: missing ';' before '{'                  //on opening curly bracket of .cpp file function
  error C2447: '{': missing function header (old-style formal list?) //on opening curly bracket of .cpp file function
  </code></pre>
  <p>The current state of the code:</p>
  <pre class="lang-cpp prettyprint-override"><code>//HEADER
  std::pair&lt;uint8_t*, uint32_t&gt;* DECLSPEC __cdecl HandleUpdate(uint8_t* MessageBuffer, uint32_t MessageLength) const;
  
  //CPP
  std::pair&lt;uint8_t*, uint32_t&gt;* DECLSPEC __cdecl EACServer::HandleUpdate(uint8_t* MessageBuffer, uint32_t MessageLength)
  {
      //do some cool stuff
      std::pair&lt;uint8_t*, uint32_t&gt; tmp( MessageBuffer, MessageLength );
      this-&gt;messageArray[this-&gt;messagesInArray] = tmp;
      this-&gt;messagesInArray += 1;
      return this-&gt;messageArray;
  }
  </code></pre>
  <p>I'm using VS 2017 and compiling to Release x64 on a Windows 10 x64 machine.</p>
  <p>Is there something wrong with the way I defined the return type?</p>
  <p>All advice is greatly appreciated.</p>
  <blockquote>
  <p><em><strong>MINIMUM REPRODUCIBLE EXAMPLE</strong></em></p>
  </blockquote>
  <p><strong>Header file</strong></p>
  <pre><code>// Foo.h
  #pragma once
  #ifndef Foo_H
  #define Foo_H
  
  #include &lt;stdint.h&gt;
  #include &lt;string&gt;
  #include &lt;utility&gt;
  
  class Foo:
  {
  public:
      std::pair&lt;uint8_t*, uint32_t&gt;* DECLSPEC __cdecl HandleUpdate( uint8_t* 
      MessageBuffer,uint32_t MessageLength );
  private:
      mutable std::pair&lt;uint8_t*, uint32_t&gt;* messageArray;
      mutable int messagesInArray;
  }
  
  </code></pre>
  <p><strong>.CPP file:</strong></p>
  <pre><code>#include &quot;stdafx.h&quot;
  #include &lt;iostream&gt;
  
  #include &quot;Foo.h&quot;
  
  typedef int( __cdecl* MYPROC )( LPWSTR );
  
  std::pair&lt;uint8_t*, uint32_t&gt;* DECLSPEC __cdecl EACServer::HandleUpdate(                                               uint8_t* MessageBuffer, uint32_t MessageLength )
  {
      std::pair&lt;uint8_t*, uint32_t&gt; tmp( MessageBuffer, MessageLength );
      this-&gt;messageArray[this-&gt;messagesInArray] = tmp;
      this-&gt;messagesInArray += 1;
  return this-&gt;messageArray;
  }
  
  int main()
  {
  Foo bar = Foo();
  uint8_t* MessageBuffer = 0;
  uint32_t MessageLength = 0;
  std::pair&lt;uint8_t*, uint32_t&gt;* result = bar.HandleUpdate(MessageBuffer, MessageLength);
  }
  </code></pre>