title: close function not being recognized - C++
body: <p>I have the following piece of code in a file called <code>RaftLog.cc</code>:</p>
  
  <pre><code>#include &lt;algorithm&gt;
  #include &lt;fcntl.h&gt;
  #include &lt;sys/stat.h&gt;
  
  
  
  namespace LogCabin {
  namespace Server {
  namespace RaftConsensusInternal {
  
  namespace FilesystemUtil = Storage::FilesystemUtil;
  
  namespace {
  bool
  fileToProto(const std::string&amp; path, google::protobuf::Message&amp; out)
  {
      int fd = open(path.c_str(), O_RDONLY);
      if (fd == -1)
          return false;
      else
          close(fd);
      FilesystemUtil::FileContents file(path);
  
          // more code down here, not useful to the problem.
  </code></pre>
  
  <p>However, when I compile I have:</p>
  
  <pre><code>build/Server/RaftLog.cc: In function ‘bool LogCabin::Server::RaftConsensusInternal::{anonymous}::fileToProto(const string&amp;, google::protobuf::Message&amp;)’:
  build/Server/RaftLog.cc:43:17: error: ‘close’ was not declared in this scope
  build/Server/RaftLog.cc: In function ‘void LogCabin::Server::RaftConsensusInternal::{anonymous}::protoToFile(google::protobuf::Message&amp;, const string&amp;)’:
  build/Server/RaftLog.cc:76:13: error: ‘close’ was not declared in this scope
  In file included from ./Server/RaftConsensus.h:17:0,
  </code></pre>
  
  <p>I don't know why the <code>close()</code> function does not get included by <code>#include &lt;fcntl.h&gt;</code>. May someone please help me? Also let me know if I should include more code.</p>