0

So I just got through a bunch of compiler issues and finally make runs well for the most part, however now I am getting an error

g++  prog4.cc
g++ -o lextest prog4.o Lexer.o Token.o
g++: prog4.o: No such file or directory
make: *** [lextest] Error 1

This is my makefile

OBJ = prog4.o Lexer.o Token.o
LEXER = Lexer.cc Lexer.h
TOKEN = Token.cc Token.h
OPTS = -g -c -Wall -Werror

lextest: $(OBJ)
        g++ -o lextest $(OBJ)

prog4.o: prog4.cc $(LEXER) $(TOKEN)
        g++ $(OPTS) prog4.cc

Lexer.o: Lexer.cc Lexer.h
        g++ $(OPTS) Lexer.cc

Token.o: Token.cc Token.h
        g++ $(OPTS) Token.cc

clean:
        rm -f *.o *~

Can anyone see any obvious errors in the makefile or would this error be generated by an issue in prog4.cc?

Pretty new to C++, so I hope this is just some simple error that I can fix.

Thanks!

wakey
  • 2,283
  • 4
  • 31
  • 58

1 Answers1

0

You are missing the -c and -o options to g++

g++ -c -o prog4.o $(OPTS) prog4.cc
Sam Varshavchik
  • 114,536
  • 5
  • 94
  • 148