Domanda

I have compiled project with qmake (qmake -project; qmake; nmake). When I opened file .pro, to reload project I got the following error:

The item "debug\moc_Rls.cpp" already exists under the filter "Generated Files"

Project, being part of soultion now is unavailiable when I open solution.

The evidient question: what to do?

È stato utile?

Soluzione

Oh, sorry it was my mistake I thought you were on Linux.

Follow these step:

1.Open the [Project_Name].vcxproj.filters file under project directory.

2.See the following lines (I am pasting mine)

  <ItemGroup>
    <ClCompile Include="Main.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="FunctBank.c">
      <Filter>Source Files</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="funcDef.h">
      <Filter>Header Files</Filter>
    </ClInclude>
  </ItemGroup>

3.Here you will see debug\moc_Rls.cpp defined twice under two filters.

4.One of them I can guess is

<ClInclude Include="debug\moc_Rls.cpp">
  <Filter>Generated Files</Filter>
</ClInclude>

And the other one you have to detect yourself.

After finding remove that filter and your project will run smoothly.

Altri suggerimenti

This is an old question but I just experienced this issue so am sharing the solution. I had used QTCreator to create a form class in another subfolder. In doing so the "duplicate" files had been added to the qrc file, which for some reason QTCreator saw as the project file. Removing the entries from the qrc fixed it.

I encountered this issue pretty recently. Even with VS19. Deleting duplicate from filters didn't solve my issue. So to solve it you need to delete that from .vcxproj file as well.

Summary:

  • -Delete duplicates from Yourfancyproject.vcxproj.
  • -Delete duplicates from Yourfancyproject.vcxproj.filters

Then problem supposed to be fixed.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top