Eclipse C/C函数"printf"无法解析 [英] Eclipse C/C function 'printf' could not be resolved

查看:461
本文介绍了Eclipse C/C函数"printf"无法解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Eclipse上建立C/C ++开发环境.

I'm trying to set up a C/C++ development environment on Eclipse.

我安装了以下Eclipse插件:

I installed the following Eclipse plugins:

  • C/C ++开发工具SDK
  • 库API文档悬停帮助
  • 单元测试支持
  • 编译器支持

然后下载 MinGW .

我按照以下步骤进行设置:

I followed this for set up: Set up Eclipse C++ compiler without auto-install or altering System Path on Windows then:

Menu *Project* ? *Properties* ? *"C/C++ Include Paths and Symbols"* ? *"Add External Include path...". I added these paths:
C:\MinGW\lib\gcc\mingw32\4.4.0\include
C:\MinGW\lib\gcc\mingw32\4.4.0\include\c++
C:\MinGW\lib\gcc\mingw32\4.4.0\include\c++\backward
C:\MinGW\lib\gcc\mingw32\4.4.0\include\c++\mingw32
C:\MinGW\lib\gcc\mingw32\4.4.0\include-fixed

它仍然给我一个无法解析'printf'函数"错误或与此相关的任何其他函数.

It still gives me a "Function 'printf' could not be resolved" error or any other function for that matter.

这是代码

#include <stdio.h>

int main() {
    printf("Hello, World!!!!");
    return 0;
}

当我执行 Ctrl + Space 时,Eclipse给了我有关C ++函数的建议,但是当我选择它们时却给出了相同的错误.这可能是一个简单的设置更改.如果您能帮助我解决这个问题,那将真的很有帮助.

When I do Ctrl + Space, Eclipse gives me suggestions for C++ functions, but it gives the same error when I select them. It's probably a simple settings change. It would be really helpful if you could help me figure this out.

推荐答案

您必须在main()上方包括<stdio.h>.这应该可以解决:

You must include <stdio.h> above your main(). This should solve it:

#include <stdio.h>
int main() {
    printf("Hello World!!!");
    return 0;
}


有时候,Eclipse的解析器变得愚蠢.您可以尝试重新分析项目.右键单击您的项目,然后→索引重建.重建后,很可能会识别出这些符号.


Sometimes, Eclipse's parser gets stupid. You can try reparsing the project. Right click on your project then → IndexRebuild. After rebuild, most likely the symbols will be recognized.

这篇关于Eclipse C/C函数"printf"无法解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆