test_rnd1 fully converted to c++ program

Fix c++ detection macro in pagebuf.h
Revamp generation of compiler flags