• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem with #include <unistd.h> - 'close' was not declared
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with #include <unistd.h> - 'close' was not declared


  • Subject: Re: Problem with #include <unistd.h> - 'close' was not declared
  • From: Alastair Houghton <email@hidden>
  • Date: Tue, 20 Nov 2007 12:47:04 +0000

On 20 Nov 2007, at 09:13, Tom O'Grady wrote:

I have the line '#include <unistd.h>' in my stdafx.h but I get an error saying that: 'close' was not declared in this scope. And it seems that "usr/include/sys/unistd.h" is being found rather than the "usr/include/unistd.h" which is intended.
I don't know what other information to supply, but if there are any build settings that might give anybody a clue as to how to solve this problem, please let me know and I'll post them too.

Hi Tom,

You don't say how you determined that "/usr/include/sys/unistd.h" was being included instead of "/usr/include/unistd.h".

One of the most common causes of problems with close() in mixed Windows/non-Windows sockets code is that some smart-alec has #defined close() in one of the program's headers so that it calls closesocket() instead. My guess is that this is actually what your problem is here, and that it looks like it's being fixed when you manually include /usr/ include/unistd.h because of where you're writing the extra #include line.

Another thing to note (if you haven't already realised; I assume you must have, but I imagine that this is a common problem also) is that "stdafx.h" is a Microsoft-ism. It's broadly equivalent to Xcode/GCC's "Prefix headers" feature, but there is no general equivalent in the C, C++ or ObjC languages so if you plan on being portable to other systems you may want to restrict usage of this feature to platform- specific files.

Kind regards,

Alastair.

--
http://alastairs-place.net


_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Problem with #include <unistd.h> - 'close' was not declared
      • From: "Tom O'Grady" <email@hidden>
References: 
 >Problem with #include <unistd.h> - 'close' was not declared (From: "Tom O'Grady" <email@hidden>)

  • Prev by Date: [Xcode-Users] Debugger exited with status 10/11
  • Next by Date: Re: Difference between NIB and XIB
  • Previous by thread: Problem with #include <unistd.h> - 'close' was not declared
  • Next by thread: Re: Problem with #include <unistd.h> - 'close' was not declared
  • Index(es):
    • Date
    • Thread