ATL simple object wizard - "Object Xxx already exists" error
Asked Answered
D

3

5

I am attempting to create a new COM object in my DLL using the ATL Simple Object Wizard in Visual Studio 2005.

I enter the short name for the object, and all of the other fields are derived.

However, when I click Next in the wizard, the following error message comes up:

Object 'IXxxInterfaceName' already exists

I have searched my entire solution for all references to IXxxInterfaceName and can't see it defined anywhere.

How is the wizard determining that it exists already?

Donetsk answered 12/3, 2009 at 0:46 Comment(0)
D
2

I never found out why the wizard determined that the object name existed already - I'm guessing something was cached somewhere that I couldn't track down.

In the end, I appended a 2 to the end of the interface name when creating it which allowed it to be added. Then I replaced all the occurrences of IXxxInterfaceName2 with IXxxInterfaceName. Everything worked after this.

If I ever track down the root cause of this problem, I'll update the answer.

Donetsk answered 8/4, 2009 at 6:13 Comment(5)
The problem still exists and it is 2015. Deleting an existing 'ATL Simple Object' means you can't re-generate. At least I have not found a way to do it. I have even resorted to cleaning out the registry from previous attempts. Microsoft has never owned up to this problem.Inversion
A workaround to this second-time-around-ATL-Simple-Object code generation failure is to create a new MFC project with Automation. Add a new class of type ATL Simple Object. Then copy the newly generated . ....rgs and .h and .cpp files over into your project.Inversion
Check your .idl file. Creating an 'ATL Simple Object' adds interface statements. Delete all of these added lines and error goes away.Inversion
I've had this issue with just adding .NET C++ objects. No idea why it wouldnt work but followed this workaround (successfully so far)Tillery
Solution to this issue is to close Vs and delete .db file from project directoryHandicap
L
1

Is it defined in a library you are referencing?

Linguiform answered 12/3, 2009 at 0:56 Comment(4)
It could be. Can you think of an easy way I could figure this out without having to resort to brute force for every library I am referencing?Donetsk
Actually now that I think about it, it's not very likely that it would be used in a library I am referencing. The interface name has a standard prefix used by all of the interfaces in our product. So I doubt any 3rd-party libraries would use the same name.Donetsk
true. it's a weird one. what happens if you chnage the name slightly?Linguiform
Well, I appended a 2 to the end of the interface name and it worked. Then I replaced all the occurrences of IXxxInterfaceName2 with IXxxInterfaceName. Seems to compile, although I'm still getting problems trying to invoke API methods across COM. Hopefully I'll figure them out today.Donetsk
W
0

Also happens in VS 2008. However Clean solution and Clean project from build option solves this :-)

Walrus answered 10/12, 2011 at 0:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.