Problem: Visual C MFC Dialog editor “Failed to return new Code Element. Possibly syntax error. New Element Name test”

902 Views Asked by At

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).

2

There are 2 best solutions below

1
gm.sandels On

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.

1
Mark Colvin On

0

I discovered that (at least in my case) deleting the .APS file, i.e. ".aps", remedied the situation. Swapping back and forth between two versions of a dialog, the dialog editor can get out of sync for the current .RC code. Removing the .APS file and reloading the solution and opening the dialog editor for this dialog fixes this issue.

I'm using VS 2012.