Search code examples
javacompilationcompiler-errorsmakefilejavac

Cannot find symbol (extends another class)


I have my file structure as (they are in the package assigment):

prog/
    src/assignment/
    bin/assignment/
    lib/assignment/

The files I am compiling are in src, and are being compiled to bin. The command I type is javac -d ./bin/ -cp ./bin/:./src/ -target 1.7 ./src/assignment/*.java

I have also tried javac -d ./bin/ -cp ./bin/:./src/ -target 1.7 ./src/assignment/GoodBrain.java ./src/assignment/LameBrain.java ./src/assignment/Board.java

For some reason I cannot two class files, the error message is 'cannot find symbol' (it points to the Board class and the LameBrain class).

The error message:

javac -g -d ./bin/ -cp ./src/:. -target 1.7 src/assignment/GoodBrain.java
src/assignment/GoodBrain.java:3: error: cannot find symbol
public class GoodBrain extends LameBrain{
                               ^
  symbol: class LameBrain
src/assignment/GoodBrain.java:11: error: cannot find symbol
    public double rateBoard(Board board) {
                            ^
  symbol:   class Board
  location: class GoodBrain
2 errors
make: *** [bin/assignment/GoodBrain.class] Error 1

It is the same error for all the commands that I type in. Please tell me if I need to provide any new information


Solution

  • I fixed the error, it was because I forgot to include the package statement. Very dumb mistake