I am trying to compile a library file using other library files. I use the following line in my makefile to create gameobject.o:
lib/gameobject.o: src/gameobject.cpp src/vector.hpp lib/objectevent.o lib/sprite.o
g++ $^ -c -o $@ $(SFML_FLAGS)
All dependencies are copied correctly, but I get the following error when I try to compile gameobject.o:
g++: fatal error: cannot specify -o with -c, -S or -E with multiple files
I'm still a little new to using make / separating compilation, so I'm not quite sure what to do. Should I just compile it without setting output? Should I compile gameobject.o without using any of my other .o files? If this is true, would compilation time not be large for large objects if you cannot compile libraries with other libraries? Or am I just reading this error completely wrong?
source
share