Fix c++ header gates generation