C语言 下载头文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4387862/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Downloading Header Files
提问by Nikhil Menon
Where can i download the following header files for dev c
我在哪里可以下载 dev c 的以下头文件
sys/types.h sys/socket.h netinet/in.h arpa/inet.h
sys/types.h sys/socket.h netinet/in.h arpa/inet.h
and also the structure
还有结构
sockadder and it's derivatives?
sockadder 及其衍生产品?
回答by thkala
I don't know why you need to downloadthese specific files, since they should come with your compiler suite in most modern systems.
我不知道您为什么需要下载这些特定文件,因为在大多数现代系统中,它们应该与您的编译器套件一起提供。
You should also keep in mind that they can be radically different depending on your platform and that those files often #includeother non-standard files (which #includeothers and so on). This could make those files very hard to parse and understand.
您还应该记住,根据您的平台,它们可能完全不同,并且这些文件通常是#include其他非标准文件(#include其他文件等等)。这可能会使这些文件很难解析和理解。
That said, from some indeterminate version of Linux:
也就是说,来自某些不确定版本的 Linux:
http://linux.die.net/include/sys/types.h
http://linux.die.net/include/sys/types.h
http://linux.die.net/include/sys/socket.h
http://linux.die.net/include/sys/socket.h
http://linux.die.net/include/netinet/in.h
http://linux.die.net/include/netinet/in.h
http://linux.die.net/include/arpa/inet.h
http://linux.die.net/include/arpa/inet.h
If you are going to replace missing files, consider getting/reinstalling a proper compiler suite and any developer packages your are missing.
如果您要替换丢失的文件,请考虑获取/重新安装合适的编译器套件以及您丢失的任何开发人员包。
If you want to look at the structure definitions you should definitely be looking at the documentation rather than the actual implementations. That way you avoid tying your code to private definitions e.t.c. that can change between systems.
如果您想查看结构定义,您绝对应该查看文档而不是实际实现。这样您就可以避免将您的代码绑定到可以在系统之间更改的私有定义等。
EDIT:
编辑:
Just to confirm some of my comments above, struct sockaddrfor said version of Linux is defined piece-by-piece in:
只是为了确认我上面的一些评论,struct sockaddr对于上述版本的 Linux 是在以下内容中逐个定义的:
http://linux.die.net/include/bits/socket.h
http://linux.die.net/include/bits/socket.h
回答by Andrew White
What SDK are you working with? For Linux you get these files as part of your core C sdk. For Windows it comes with the SDK as well. If you just want a quick and dirty look at someheader files I use http://www.google.com/codesearch.
您在使用什么 SDK?对于 Linux,您将这些文件作为核心 C sdk 的一部分。对于 Windows,它也随 SDK 一起提供。如果您只想快速查看一些头文件,我使用http://www.google.com/codesearch。
回答by pmg
Those headers(not header files) are part of the implementation. They need not be real files.
这些头文件(不是头文件)是实现的一部分。它们不必是真实文件。
If your implementation does not provide them, you're out of luck.
如果您的实现没有提供它们,那么您就不走运了。
If your implementation provides them as real files and you deleted them, reinstalling the compiler might work.
如果您的实现将它们作为真实文件提供并且您删除了它们,则重新安装编译器可能会起作用。
If your implementation provides them as real files and you cannot reinstall the compiler your approach might work. Sorry, I have no idea where to download the files --- or why would anyone copy the files somewhere in the first place.
如果您的实现将它们作为真实文件提供并且您无法重新安装编译器,那么您的方法可能会起作用。抱歉,我不知道从哪里下载文件 --- 或者为什么有人首先将文件复制到某个地方。
回答by karlphillip
I'm assuming that you are trying to compile a source code for the *nix platform under another, such as Windows. This approach won't do you any good. Remember that you'll need the libraries of those headers and they are not portable.
我假设您正在尝试在另一个平台(例如 Windows)下为 *nix 平台编译源代码。这种方法对你没有任何好处。请记住,您将需要这些头文件的库,并且它们不可移植。
Install a Virtual Machine with Ubuntu on your PC to do this kind of development.
在您的 PC 上安装一个带有 Ubuntu 的虚拟机来进行这种开发。
回答by Neilvert Noval
do:
apt-get install gcc-4.2

