Fix compilation problems in generated cpp code

Change-Id: I6419578daf19d19232cfb4130cd2c77189812c19