I suggest using a Makefile like this. You'll have to replace the spaces with tabs.
Make has built-in rules that automatically know how to build .c, .cpp, and other source files.
OBJECTS = swara.o synth.o unit.o sinewave.o
LDFLAGS = -lstdc++ -lportaudio -lsndfile
TARGET = Swara
# Default target: all
$(CC) $(CFLAGS) $(OBJECTS) -o $(TARGET) $(LDFLAGS)
# Source files
swara.o: swara.cpp swara.hpp
synth.o: synth.cpp synth.hpp
unit.o: unit.cpp unit.hpp
sinewave.o: sinewave.cpp sinewave.hpp
The blue code can be automatically generated (with the proper dependencies) with
Also see matsp's suggestions.
And you might perhaps want some targets like this:
Finally, if you want to set a breakpoint or whatever on line 80 of a different file from the current one in gdb, use
rm $(OBJECTS) $(TARGET)
GDB has a pretty extensive help system. You can type help or help breakpoints etc to get more information. And there's always some online manuals and tutorials for gdb. (One on this very site.)
(gdb) break otherfile.cpp:80
 Oh yes, and if you create a file called, say, all, then the all target won't work properly. You'll have to add
etc if you create files by those names. [/edit]
.PHONY: all clean run