title: SHGetKnownFolderPath was not declared in this scope
body: <p>I've been studying Java-programming for about 7 months now and I've become interested in c++. I'm currently reading a c++ book too. </p>
  
  <p>I'm using eclipse c++ since I'm pretty familiar with eclipse.</p>
  
  <p>I have made like 6 projects (small ones) in c++ and everything has worked fine until now.</p>
  
  <p>My problem is that I can not get the SHGetKnownFolderPath method to work.
  The complete line is red , eventhough I have imported everything, build it, tried to run it. I have checked on internet sites and I've used the same code as other people has, but still not working for me.</p>
  
  <p>It says: Function SHGetKnownFolderPath could not be resolved</p>
  
  <p>I'm on a windows 8 computer 64 bit.
  Here is the code:
  <strong>UPDATE</strong></p>
  
  <pre><code>    #define WINVER 0x0600 // 0x06020000  0x06030000
  #include &lt;shlobj.h&gt;
  #include &lt;windows.h&gt;
  #include &lt;combaseapi.h&gt;
  #include &lt;comutil.h&gt; //for _bstr_t (used in the string conversion)
  #include &lt;knownfolders.h&gt;
  #include &lt;winerror.h&gt; //for HRESULT
  #include &lt;winnt.h&gt;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  
  
  
  
  
  
  using namespace std;
  
  int main(){
  
      LPWSTR wszPath = NULL;
      HRESULT hr;
  
      hr = SHGetKnownFolderPath(FOLDERID_Documents, 0, NULL, &amp;wszPath);// THIS LINE IS COMPLETELY RED
  
      if (SUCCEEDED(hr)){
      _bstr_t bstrPath(wszPath);
      std::string strPath((char*)bstrPath);
      std::cout &lt;&lt; strPath;
      }
  
      CoTaskMemFree(wszPath);
  
  return 0;
  }
  </code></pre>
  
  <p>Here is the log:</p>
  
  <pre><code>     #pragma comment(lib, "comsuppw")
   ^
  ..\src\HelloWorld.cpp: In function 'int main()':
  ..\src\HelloWorld.cpp:21:64: error: 'SHGetKnownFolderPath' was not declared in this scope
   hr = SHGetKnownFolderPath(FOLDERID_Documents, 0, NULL, &amp;wszPath);
  </code></pre>
  
  <p>There is a little arrow pointing at the last parenthesis under &amp;wszPath)</p>
  
  <p>What could possibly be wrong?
  I will be grateful for all answers or hints that I could get.</p>