C++ 未解决的包含:Eclipse helios 中的 <stdio.h>(Windows 7 64 位)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19453483/
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
Unresolved inclusion: <stdio.h> in Eclipse helios (Windows 7 64bit)
提问by Belgi
I am trying to install Eclipse on my computer: I have a 64bit Windows 7.
我正在尝试在我的计算机上安装 Eclipse:我有一个 64 位的 Windows 7。
I have installed a 64bit Java, and a 64bit version of Eclipse helios (C/C++).
我已经安装了 64 位 Java 和 64 位版本的 Eclipse helios (C/C++)。
When I tried to compile a hello world project I got an error
当我尝试编译 hello world 项目时出现错误
Unresolved inclusion: < stdio.h>
未解决的包含:<stdio.h>
I have inserted another space since the text didn't render.
由于文本未呈现,我插入了另一个空格。
I have tried looking for solutions on this site and on Google, but the best thing I found was this post.
我曾尝试在本网站和谷歌上寻找解决方案,但我发现最好的事情是这篇文章。
But I don't know where to locate stdio.h myself.. I have used the search on my computer and didn't find such a file. maybe I don't have one, what should I do ?
但是我自己不知道在哪里可以找到stdio.h..我在我的电脑上使用了搜索,没有找到这样的文件。也许我没有,我该怎么办?
回答by N A
The location of your headers depends on what tool chain you are using. You can go to Properties -> C/C++ Build -> Tool Chain Editor
to find out which it is. Once you know that, you need to locate the headers and include them (in manner your postsuggests). For example hereis example of someone having the same issue with MinGW tool chain. Find you about your tool chain and I will attempt to guide you if I will be able to.
标题的位置取决于您使用的工具链。你可以去Properties -> C/C++ Build -> Tool Chain Editor
看看它是哪个。知道这一点后,您需要找到标题并包含它们(以您的帖子建议的方式)。例如,这里是有人在使用 MinGW 工具链时遇到相同问题的示例。找到你关于你的工具链的信息,如果可以的话,我会尝试指导你。
回答by Magnetron
If you changed the current toolchain, please reopen(close and open) the project.
如果您更改了当前工具链,请重新打开(关闭并打开)项目。
回答by czxttkl
I have a similar issue. It is due to not installing cygwin/gcc and not adding cygwin_install_path/bin to Path.
我有一个类似的问题。这是由于没有安装 cygwin/gcc 并且没有将 cygwin_install_path/bin 添加到 Path。
回答by TimStaley
What is the suffix of your filename - foo.c? foo.cc?
你的文件名的后缀是什么 - foo.c?foo.cc?
By default, Eclipse assumes that .c files should be parsed to the C standard, while .cc files should be parsed as C++. So, if you have C++ code in a file ending with .c, it tries to parse C++ as C, and often stumbles as soon as it hits a standard library include.
默认情况下,Eclipse 假定 .c 文件应解析为 C 标准,而 .cc 文件应解析为 C++。因此,如果在以 .c 结尾的文件中有 C++ 代码,它会尝试将 C++ 解析为 C,并且通常在遇到标准库 include 时就会出错。
The easiest solution is to rename your files to *.cc. You can see Eclipse's list of suffix associations by going to Window->Preferences->C/C++->File Types
, but unfortunately it doesn't seem to be possible to change the defaults.
最简单的解决方案是将您的文件重命名为 *.cc。您可以通过转到 来查看 Eclipse 的后缀关联列表Window->Preferences->C/C++->File Types
,但不幸的是,似乎无法更改默认值。