Hello all,
I just wanted to let you know that I figured out my problem. It had nothing to do with Boost.Test and had everything to do with my Makefile.
My Makefile was literally telling g++ to try and compile main.cpp twice and place the output in bin.
- I had defined an implicit rule to compile all .cpp files to .o files, like so:
$(ODIR_TEST)/%.o : $(SDIR_TEST)/%.cpp
$(CC) $(CXXFLAGS) -c $< -o $@
- And silly me, I wrote the default rule as follows:
$(OUTDIR)/$(PROG) : $(SDIR_TEST)/main.cpp $(TEST_OBJS)
$(CC) $(CXXFLAGS) -o $@ $^
$(TEST_OBJS) is just a list of all .o files prefixed with ./bin/.
As you can imagine, taking $(SDIR_TEST)/main.cpp out of the list of prerequisites completely fixed the issue. I was able to compile and run all 34 tests successfully from one executable.
Hurray!!
It feels good to have figured this out, especially because I was able to do so on my own, but also makes me feel quite silly. Oh well, now I know.
My apologies for burdening your inboxes with my stupidity.
- AJ