title: read was not declared error message
body: <p>I am cross compiling a package (<code>libqmi</code>).(With simple compiling it was fine.)</p>
  
  <p>The problem came out when I tried to comply a c++ part.
  I got the message that is </p>
  
  <p><code>"read is not declared"</code>.</p>
  
  <p>I know it does not need to be included in case of C, but what about C++?</p>
  
  <p>I tried to add the headers by hand: <code>fcntl.h</code> and <code>unistd.h</code> too, without any solution.
  (the compiler found them and included, but the error message is still left)</p>
  
  <p>Do you have any idea what the problem can be behind this?
  I do not think the problem is wrong, as it is a realised and good with host compiler.</p>
  
  <p>EDIT:
  thanks the comments.
  host: Linux, x86,
  target: Linux, arm</p>
  
  <p>unistd.h header does not solved the problem:
  I also tried type alloc, maybe there is misalloc.
  GobiQMICore.cpp: In member function 'virtual std::vector, std::basic_string > > cGobiQMICore::GetAvailableDevices()':
  GobiQMICore.cpp:319:39: error: 'read' was not declared in this scope
  GobiQMICore.cpp:334:21: error: 'close' was not declared in this scope</p>
  
  <p>the code:</p>
  
  <pre><code>/*===========================================================================
  METHOD:
     GetAvailableQDLPorts (Public Method)
  
  DESCRIPTION:
     Return the set of available Gobi QDL ports
  
  RETURN VALUE:
     std::vector &lt;sDeviceID&gt;
  ===========================================================================*/
  std::vector &lt;std::string&gt; cGobiQDLCore::GetAvailableQDLPorts()
  {
     std::vector &lt;std::string&gt; devices;
  
     std::string path = "/sys/bus/usb/devices/";
  
     std::vector &lt;std::string&gt; files;
     DepthSearch( path,
                  2,
                  "ttyUSB",
                  files );
  
     int fileNum = files.size();
     for (int i = 0; i &lt; fileNum; i++)
     {
        // Example "/sys/bus/usb/devices/8-1/8-1:1.1/ttyUSB0"
        std::string nodePath = files[i];
  
        int lastSlash = nodePath.find_last_of( "/" );
  
        // This is what we want to return if everything else matches
        std::string deviceNode = nodePath.substr( lastSlash + 1 );
  
        // Move down one directory to the interface level
        std::string curPath = nodePath.substr( 0, lastSlash );
  
        // Read bInterfaceNumber
        int handle = open( (curPath + "/bInterfaceNumber").c_str(), 
                           O_RDONLY );
        if (handle == -1)
        {
           continue;
        }
  
        char buff[4];
        memset( buff, 0, 4 );
  
        bool bFound = false;
        int ret = read( handle, buff, 2 );
        if (ret == 2)
        {
           // Interface 1 or 0
           ret = strncmp( buff, "01", 2 );
           if (ret == 0)
           {
              bFound = true;
           }
           ret = strncmp( buff, "00", 2 );
           if (ret == 0)
           {
              bFound = true;
           }
  
        }
        close( handle );
  
        if (bFound == false)
        {
           continue;
        }
  
        // Move down one directory to the device level
        curPath = curPath.substr( 0, curPath.find_last_of( "/" ) );
  
        // Read idVendor
        handle = open( (curPath + "/idVendor").c_str(), O_RDONLY );
        if (handle == -1)
        {
           continue;
        }
        bFound = false;
        ret = read( handle, buff, 4 );
        if (ret == 4)
        {
           ret = strncmp( buff, "05c6", 4 );
           if (ret == 0)
           {
              bFound = true;
           }
        }
        close( handle );
  
        if (bFound == false)
        {
           continue;
        }
  
        // Read idProduct
        handle = open( (curPath + "/idProduct").c_str(), O_RDONLY );
        if (handle == -1)
        {
           continue;
        }
        bFound = false;
        ret = read( handle, buff, 4 );
        if (ret == 4)
        {
           ret = strncmp( buff, "920c", 4 );
           if (ret == 0)
           {
              bFound = true;
           }
        }
        close( handle );
  
        if (bFound == false)
        {
           continue;
        }
  
        // Success!
        devices.push_back( deviceNode );
     }
  
     return devices;
  }
  </code></pre>
  
  <p>T</p>