Moved to g++ and fix all compiler errors and warnings.