title: Getting string compile errors in visual studio using the boost string lib
body: <p>i am trying to make a program that reads from an ini file but in Visual Studio I keep getting compile errors about string identifiers and semicolons in the wrong place. I am not very good at C++ so it's most likely something really simple, but any way here is the code and error list.</p>
  
  <p><em>INI.h</em></p>
  
  <pre><code>#ifndef INI_H
  #define INI_H
  
  #include &lt;boost/property_tree/ptree.hpp&gt;
  #include &lt;boost/property_tree/ini_parser.hpp&gt;
  #include &lt;boost/algorithm/string.hpp&gt;
  #include &lt;iostream&gt;
  
  string INIreader(const string&amp;, const string&amp;);
  
  #endif
  </code></pre>
  
  <p><em>INI_readnwrite.cpp</em></p>
  
  <pre><code>#include "INI.h"
  
  using boost::property_tree::ptree;
  
  string INIreader(const string&amp; section, const string&amp; name)
  {
      ptree pt;
      read_ini("GameSettings.ini", pt);
      string value = pt.get&lt;string&gt;("section.name");
      return value;
  }
  </code></pre>
  
  <p><em>mainCode.cpp</em></p>
  
  <pre><code>#include "INI.h"
  
  using namespace std;
  int main()
  {
      string sec = "gameSettings";
      string val = "resXY";
      cout &lt;&lt; INIreader(sec, val);
  }
  </code></pre>
  
  <p>And here is the error list</p>
  
  <pre><code>error// file//  line//
  error C2872: 'string' : ambiguous symbol    maincode.cpp    18
  error C2146: syntax error : missing ';' before identifier 'sec' maincode.cpp    18
  error C2065: 'sec' : undeclared identifier  maincode.cpp    18
  error C2872: 'string' : ambiguous symbol    maincode.cpp    19
  error C2146: syntax error : missing ';' before identifier 'val' maincode.cpp    19
  error C2065: 'val' : undeclared identifier  maincode.cpp    19
  error C2065: 'val' : undeclared identifier  maincode.cpp    20
  error C2065: 'sec' : undeclared identifier  maincode.cpp    20
  error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   ini_readnwrite.cpp  6
  error C2872: 'string' : ambiguous symbol    ini_readnwrite.cpp  6
  error C2146: syntax error : missing ';' before identifier 'INIreader'   ini_readnwrite.cpp  6
  error C2143: syntax error : missing ',' before '&amp;'  ini_readnwrite.cpp  6
  error C2086: 'int string' : redefinition    ini_readnwrite.cpp  6
  error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   ini_readnwrite.cpp  7
  error C2974: 'boost::property_tree::basic_ptree&lt;std::string,std::string,std::less&lt;Key&gt;&gt;::get' : invalid template argument for 'Type', type expected ini_readnwrite.cpp  10
  error C2974: 'boost::property_tree::basic_ptree&lt;std::string,std::string,std::less&lt;Key&gt;&gt;::get' : invalid template argument for 'Ch', type expected   ini_readnwrite.cpp  10
  error C2146: syntax error : missing ';' before identifier 'value'   ini_readnwrite.cpp  10
  error C2065: 'value' : undeclared identifier    ini_readnwrite.cpp  10
  error C2065: 'value' : undeclared identifier    ini_readnwrite.cpp  11
  IntelliSense: identifier "string" is undefined  INI.h   9
  IntelliSense: identifier "string" is undefined  INI.h   9
  IntelliSense: identifier "string" is undefined  INI.h   9
  error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   ini.h   9
  error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   ini.h   9
  error C2146: syntax error : missing ';' before identifier 'INIreader'   ini.h   9
  error C2146: syntax error : missing ';' before identifier 'INIreader'   ini.h   9
  error C2143: syntax error : missing ',' before '&amp;'  ini.h   9
  error C2143: syntax error : missing ',' before '&amp;'  ini.h   9
  </code></pre>
  
  <p>Thanks.</p>