Added compilation of examples and of the C++ version; fixed compilation warnings.

There are significant changes to the Makefile in this pull request.
I hope, you'll find them useful.
The most of other changes are just whitespace changes (trailing whitespaces removed) and are purely cosmetic.

Please, merge the pull request.
Thank you in advance!