得到“找不到符号”在Intellij的Java项目中 [英] Getting "cannot find Symbol" in Java project in Intellij

查看:1471
本文介绍了得到“找不到符号”在Intellij的Java项目中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从类GameManager.java调用静态单例实例。

I make this call to a static singleton instance from the class "GameManager.java".

HUD.getInstance().update(timeDelta);

HUD.java包含HUD类以及其他两个相关类,HUDTextElement和HUDElement。所有类都在相同的根路径中../ src / org / mypackage

HUD.java contains the HUD class as well as two other related classes, HUDTextElement and HUDElement. All the classes are in the same root path ../src/org/mypackage

然而,当在IntelliJ中编译这个java项目时,我得到找不到符号HUD我进行HUD.getInstance()调用的行。

However, when compiling this java project in IntelliJ I get "cannot find Symbol HUD" on the line I make the HUD.getInstance() call.

这个完全相同的代码在eclipse中编译得很好,不知道问题是什么?

This exact same code compiles just fine in eclipse, any idea what the problem is?

推荐答案

我遇到了同样的问题,结果我从未完全编译过新项目。所以右键单击并选择Compile''(在mac上的shift-cmd-F9)修复它。似乎save上的编译没有看到未编译的文件。

I had the same problem, and turns out I had never completely compiled the fresh project. So right-clicking and selecting Compile'' (shift-cmd-F9 on mac) fixed it. It seems the compile on save does not 'see' non-compiled files.

在我的情况下将src文件夹标记为源帮助。

Marking the src folder as source did not help in my case.

这篇关于得到“找不到符号”在Intellij的Java项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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