Rant about C++ dependency hell

When was the last time I vented about C++? The answer for that is always:


The initial friction to setup a substantial project using C++ is unfucking bearable.

When we started code revamp at work recently, I decided to be a good citizen and decided to incorporate cpptest, a unit testing framework in our project.

It made me realize how unreasonably complicated Makefiles can be. After 3 hours of peeling away at the complexity I managed to add cpptest to the build dependency of the project. 

Now time to write a few tests and check it out. I'm thinking "We are almost there". 


Compilation gives me a gazillion error messages that make absolutely no sense. After about 30mins of StackOverflowing and Googling, I find out that its not enough to include string.h and map.h in my  header files, but I also need to namespace it. Of course there is no indication (not even a hint) of that in the error messages. So I add 'using namespace std' and get past it.

Awesome my first test is compiling successfully. Time to run this baby and declare victory. 

Close! But no cigar.

The executable was unable to load the CppTest library during runtime. Argh!

I set my LD_LIBRARY_PATH env variable and now it's running. But I can't ask everyone in my team to do that, so I have to figure out how to statically link that library. 

It's already 6pm and I'm hungry. That'll have to wait for another day. 

TL;DR - C++ and Makefile can burn in a fire of thousand suns.