Compiling error: cannot find symbol [...]

Started by Nellousan on Fri, 11/24/2017 - 17:21

Topic category: Bugs and solutions

Last seen on 21:20, 25. Nov 2017
Joined Nov 2017
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Compiling error: cannot find symbol [...]
Fri, 11/24/2017 - 17:21

Hi ! (note: sry if you're getting bad at understanding me, i'm french)

I discovered this software earlier today and i'm already having issues with compiling. While trying to export my test mod i got an error on gradle logs that say something like "cannot find symbol[...]". I think i've miss something.

Btw my mod is act just an ore block that drop a gem (2 elements then) for testing thing like recipes, particles etc.

Here are the logs of gradle while compiling:

C:\Pylo\MCreator176\forge\build\sources\main\java\mod\mcreator\localminecrafttestmod.java:40: error: cannot find symbol
	mcreator_gem mcreator_1 = new mcreator_gem();
	^
  symbol:   class mcreator_gem
  location: class localminecrafttestmod
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Ty by advance for helping me.

Last seen on 21:20, 25. Nov 2017
Joined Nov 2017
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Hum it looks like a bug of…
Fri, 11/24/2017 - 19:27

Hum it looks like a bug of MCreator becuz when i create an element and then check on the "Code" Tab if my class is added, and if indeed it's added, it works well.

BUT

When i create an element and when i check if the class is here and it isn't, i have compilation error.

I see nothing else than a MCreator bug here.

(or maybe i missed something obvious)

Last seen on 04:02, 4. Apr 2019
Joined Apr 2019
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
The "Cannot find symbol"…
Wed, 04/03/2019 - 06:47

The "Cannot find symbol" errors generally occur when you try to reference an undeclared variable in your code. A "Cannot find symbol" error means that the compiler cannot do this. Your code appears to be referring to something that the compiler doesn't understand.

When your code is compiled, the compiler needs to work out what each and every identifier in your code means. As the compiler is going through the code it will find something and know what to do with it or not. Your Cannot find symbol error relates to the identifiers and means that Java cannot figure out what the "symbol" means.

The general causes for a Cannot find symbol error are things like:

  • Incorrect spelling.
  • Wrong case. Halo is different from halo.
  • Improper use of acceptable identifier values (letters, numbers, underscore, dollar sign), my-class is not the same as myclass.
  • No variable declaration or variable is outside of the scope you are referencing it in.