Failed to return new code element

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I have a VS2005 VC++ application which no longer allows me to add a
Variable or Function to a class in the project. I attempt to add a new
(public) Variable called Temp123, and get this error...

Failed to return new Code Element. Possibley syntax error. New Element
Name. Temp123

I recently changed the name of the cpp file (using Solution Explorer) of
this class. Since that change, the error always occurs. I attempted to
change the cpp name back to its original name, but still get the error.

Can anyone help me out.

RML
 
Hi RML

RML said:
Hi, I have a VS2005 VC++ application which no longer allows me to add a
Variable or Function to a class in the project. I attempt to add a new
(public) Variable called Temp123, and get this error...

Failed to return new Code Element. Possibley syntax error. New Element
Name. Temp123

I recently changed the name of the cpp file (using Solution Explorer) of
this class. Since that change, the error always occurs. I attempted to
change the cpp name back to its original name, but still get the error.

Can anyone help me out.

RML

Does this problem still exist if you add a new cpp file with the name you
want and copy the whole contents of the old file to the new one and remove
the old one from the solution?

Marcus
 
Hi RML
RML said:
Hi Marcus, I tried your suggestion, but still have the same problem.

RML

Next attempt: Close the poject, delete the .ncb file and reopen the project.
 
RML said:
Tried that, and it did not work.

RML

In this case, it seems to be somehow realted to your file itself. To find
the source, I would comment out the whole body of the class and see if it is
possilbe to add a new function to the empty class. If yes, uncomment more
and more parts until the problem reappears.
If you have found the reason, please share it here.

I don't see anything better to do here, sorry

Marcus
 
Here is what I did to get it to work.

I created a new class. I cut & pasted the code from the original classes .h
& .cpp files into the respective .h & .cpp files of the new class. In the
new class files, I then replace the old class name with the new, then I
deleted the original class files.

It was a round about way, but it worked.

RML
 
Here is what worked for me after wasting a half a day on the problem:

1. Close the workspace
2. Delete the Intellisense (NCB) Database
3. Reopen the workspace
4. Allow VC to rebuild the Intellisense database

Now the add method / property worked just fine.

Gary Edstrom
 
Should be added:

5. Close all solution files before adding new method.

Few times works for me only with this action.
 
Back
Top