Eclipse的C / C ++显示错误,但编译? [英] Eclipse C/C++ Shows Errors but Compiles?

查看:800
本文介绍了Eclipse的C / C ++显示错误,但编译?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我建立在Eclipse一些Arduino的code,为的你的第二个项目的Arduino ,但我每次使用一个Arduino库,如串口时,Eclipse中强调我的函数名,声称他们不能得到解决。然而,code实际上编译,让我不知所措,为什么Eclipse的认为功能缺失是一种。如果任何人有关于如何解决这个问题的任何想法,这将是AP preciated。由于事前。

So I am building some Arduino code in eclipse, as described in Your Second Arduino Project, but every time I use an Arduino library, such as Serial, Eclipse underlines my function names, claiming they cannot be resolved. However, the code actually compiles, so I'm kind of at a loss as to why Eclipse thinks the functions are missing. If anyone has any idea on how to solve this problem it would be appreciated. Thanks beforehand.

编辑:我本来应该更具体的是,Eclipse强调Arduino的库里面的方法。所以,如果我用 Serial.println(你好); ,它强调的println(),并声称它不能解决。然后,它编译就好了,当上传到Arduino板的方法工作。

I should have been more specific, Eclipse underlines the METHODS inside the Arduino libraries. So if I use Serial.println("hello");, it underlines println() and claims it cannot be resolved. Then it compiles just fine and the method works when uploaded to the arduino board.

EDIT2:我发现我的错误,原来我是想在C文件中使用一些C ++函数和Eclipse不喜欢它;我重命名为.CPP和所有的红色消失;!)感谢您的帮助。

I found my error, turns out I was trying to use some C++ functions in a C file, and eclipse didn't like it; I renamed to .cpp and all the red disappeared ;) Thanks for your help!

推荐答案

对于初学者来说,什么颜色的下划线?这使得有差别,因为黄色意味着它是一个警告,红色表示这是一个错误(关键的,不会在大多数情况下建造)。

For starters, what color is the underline? This makes a difference, as yellow means it's a warning, and red means it's an error (critical, will not build in most circumstances).

其次,你需要看看问题选项卡,看看是否有实际的错误。如果什么都没有的话,那的确正确编译。

Second, you need to look at the "Problems" tab to see if there are actual errors. If there is nothing there, then it did indeed compile correctly.

现在,回到原来的问题。根据您正在建设的项目类型,这种类型的行为是不是罕见。月食似乎做索引某些项目做得不好。当您运行命令行让所有(这是构建过程中的Eclipse确实有效的)它可能解决所有的code和构建它就好了。

Now, back to the original question. Depending on the type of project you are building, this type of behavior is not that uncommon. Eclipse seems to do a poor job of indexing certain projects. When you run "make all" from the command line (which is effectively what Eclipse does during build) it is likely resolving all of your code and building it just fine.

不过,Eclipse使用一个不同,单独的工具作为索引所有源$ C ​​$ C和解决变量/函数定义和声明。这是名副其实的左手不知道什么右手在做一个例子。

However, Eclipse uses a different, separate tool for indexing all of your source code and resolving variable/function definitions and declarations. This is literally a case of the left hand not knowing what the right hand is doing.

这篇关于Eclipse的C / C ++显示错误,但编译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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