-1

So this is my first time making a make file so its really basic. I have 2 cpp files (functions.cpp and main.cpp) and 2 header files (structDeclaration.h and Prototypes.h). It needs to be able to compile my program but if only one file changes then it shouldn't recompile the entire thing.

heres my error:

g++ -c gradebook main.o Functions.o -I. g++: error: gradebook: No such file or directory make: *** [gradebook] Error 1 and heres my makefile:

CC = g++

gradebook: main.o Functions.o 
    g++ -c gradebook main.o Functions.o -I.

main.o: main.cpp Prototypes.h structDeclaration.h Prototypes.h
    g++ -c main.cpp

Functions.o: Functions.cpp structDeclaration.h
    g++ -c Functions.cpp
Wyatt J
  • 1
  • 1

1 Answers1

3

the commands have to be valid commands. I think you mean

g++ -o gradebook main.o Functions.o

If in doubt just try typing the command you are asking make to run for you, there is no magic involved here

pm100
  • 48,078
  • 23
  • 82
  • 145