The output file given in the code generation settings could not be opened for writing, probably due to one of the following:
In the Code Generation Settings, click Browse... by Output File and select an existing folder and a new file name.