Hello I\'m writing a little project in c++ where I would like to have some classes that does some work, I wrote the interfaces and the implementation of the classes.
The
You should either compile them together (in a single g++
command) or compile both of them to object files (g++ -c
) and then use ld
to link the object files together.
Sample Makefile:
all: app.exe
app.exe: app.o animal.o
g++ -o app.exe app.o animal.o
app.o: app.cpp
g++ -c -o app.o app.cpp
animal.o: animal.cpp animal.h
g++ -c -o animal.o animal.cpp