Reputation: 85
Other similar but to my knowledge non-related questions:
How to recreate said bug/error:
The error occured when I deleted a Release folder I'd accidentally copied over from a project in another solution. All now non-functional class names are derived from the object files within that Release folder.
Solution:
I have no solution.
My questions are:
Have anyone else had this or a similar issue?
If so, have you solved it and what is your solution?
I am open to all suggestions and while this 'bug' isn't making programming impossible it is quite annoying not being able to use frequently used class names.
Upvotes: 7
Views: 5949
Reputation: 21936
Yeah, also saw that.
I think I have created a C++ class, decided I don’t like it, reverted changes using github app. But the name was good, so I tried creating same class again. Saw the exact same error as you’re having.
The name polluted the sqlite database. And because I had that VC.db in my .gitignore, git hasn't reverted that.
To fix, quit visual studio, delete the file $(SolutionName).VC.db in your $(SolutionDir) folder, restart visual studio, clean and rebuild your project[s].
Update: Modern versions of Visual Studio usually keep these SQLite databases inside .vs
folder under $(SolutionDir).
Upvotes: 11
Reputation: 325
Delete the existing *.sln when you launch VS again it will allow without any error.
Upvotes: 0
Reputation: 1
Got the same issue, which was solved by cleaning up the visual studio cache.
Just close VS, clean up the files in (for VS2015) %USERPROFILE%\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache %USERPROFILE%\AppData\Local\Temp
, and restart VS. It should go back to normal.
Upvotes: 0
Reputation: 1
I just ran into the same problem. To solve it using your example names:
After that, it will let you use that name when creating a new class with the class wizard. It's neither an elegant solution nor a complete one. It will let you get past that one problem. I suspect I'll run into it again with other names that aren't getting cleaned out of the database.
Upvotes: 0
Reputation: 880
Manually create example.h and example.cpp in Solution directory then:
Add
-> Existing Item...
-> add created file to your project.
This trick work for me after clean $(SolutionName).VC.db file.
Upvotes: 1
Reputation: 356
Seems like VS caching issue. I too faced this issue and your solution did not work for me either.
What I did is add a Class with different name lets say MainGame1
and then it allowed me to add. Then I just renamed the Class name, CPP and header file name to my like.
Upvotes: 1
Reputation: 1
Even though you don't have any .h .cpp in your project, make sure you don't have "MainGame" declaration or definition in any other .h .cpp file as an inner class either.
Upvotes: 0