1

I have a simple MFC application, using Visual Studio 2019. My problem is that when I want to add a variable to any control I get the pop up message:

Failed to return new Code Element. Possibly syntax error. New Element Name test

Screenshot of error

To clarify: The problem is in the Visual C MFC Dialog Editor. Not in my code as it runs fine. I have tried all possible solutions that I found using Google. Nothing helps. The app is very simple. The only "extra" is that I am using tinyxml2.

What I found out by Google is that this is not a new problem, and the solution was to not use precompiled headers. And I am not using precompiled headers. so...

I am stuck. A long shot: Note the "Element" in the error text, and all the "elements" in tinyxml2. Some collision of symbols ??

I hint (maybe): I have got this message once before when I was using a long variable name. I shorted the name and the error was gone.
This is my second try. When the problem turned up I removed all changes since it was OK. But the problem is still there. Somthing I did has left some, not reversable, mark in the code (or database).

Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
enocknitti
  • 31
  • 8
  • Sometimes the class wizard can get messed up. ?I have found that shutting down VS, renaming your folder and then renaming it back, triggers a rebuild of the class wizard database and sometimes cleans up issues like this. Otherwise is best to direct your issue to MS via the Feedback mechanism. – Andrew Truckle Dec 17 '20 at 23:03
  • 2
    You are not exactly clear because you refer to dialog editor, then tiny xml data files. Please be specific. Are you creating a variable? How are you creating it? Can you show any screenshot? – Andrew Truckle Dec 17 '20 at 23:06
  • Ok tried renaming, still problem. "then tiny xml data files", No data files,I just added tinyxml2 to the project, Just metioned it cus thats the only non-MS code in the projekt. I am using the dialig editor to add variables [link] (https://www.dropbox.com/s/r3cswi9fwpm3xua/MFCError.png?dl=0) – enocknitti Dec 18 '20 at 09:31
  • So, it sound sliek a Classwizard related issue. I suggest taking it up with Microsoft via teh built in support. – Andrew Truckle Dec 18 '20 at 10:15
  • 1
    Ho and behold: I started the VC2017 I still have installed. and in 2017 it works as expected. Methink I stay with 2017 :) Maybe I will try a reinstallation of 2019 later – enocknitti Dec 18 '20 at 11:02

1 Answers1

0

I discovered that (at least in my case) deleting the .APS file, i.e. "<your solution>.aps", remedied the situation.

I'm using VS 2022.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 13 '23 at 02:38