Lesson Learned [25/7/2014]

1. GCC does not compile header files

    Incorrect:
 
.PHONY: all
all: queue.o priority_queue.o
$(ARCHIVER) cr $(OUTPUT) $^

# This compilation executes but no queue.o file is output as g++ does not compile headers
queue.o : queue.h
         $(CC) $(DEBUG_FLAGS) $(RELEASE_FLAGS $(SHARED_FLAGS) -c $^

priority_queue.o : priority_queue.h priority_queue.cpp
$(CC) $(DEBUG_FLAGS) $(RELEASE_FLAGS) $(SHARED_FLAGS) -c $^

   Correct:

Simply only compile the implementation files.

Popular Posts