Paul
Paul

Reputation: 2564

Cmake and VS 2010 An item with the same key has already been added Error

I have been using cmake for a project where we generate VS 2009 project. Now we are moving to 2010 and I notice that after cmake successfully generates the build directory, I open the .sln with VS 2010, one of the projects fails to load. The output shows:

error : An item with the same key has already been added.

The GUID for that project is "29AE0C04-FA88-4802-A8FC-79D38A5E870A" and I see that there are no other projects with that GUID in the solution file.

This happens on Version 10.0.40219.1 SP1Rel with cmake 2.8.8 or 2.8.10.

Upvotes: 1

Views: 548

Answers (2)

Egon
Egon

Reputation: 56

I had the same problem using vs2010, Qt4 and CMake 2.8.10. In my case, I had the files: MainWindow.h, .cpp, .ui and Main.cpp. After generate the project, at end of file .vcxproj you'll see the text:

<ItemGroup>
...
<None Include="MainWindow.ui" />
</ItemGroup>

The line <None ... /> causes the problem. You should remove it. Thus, the filters are not lost.

Upvotes: 2

Paul
Paul

Reputation: 2564

I still don't know the reason, but the workaround is to delete the *.filters file in the project folder. This solves the problem, but as a side effect source groups are lost.

Upvotes: 0

Related Questions