This fix is a bit of a hack, I just moved the declarations into the 'user code' portion of main(). dtcodegen needs to be fixed so as not to generate this type of code in the first place.