views:

4714

answers:

7

I have a C project that is built using a makefile, Eclipse constantly warns about "Invalid project path: Duplicate path entries", but I cannot figure out what the hell it wants me to do. I would like to disable this warning and continue with my life.

My application compiles and runs fine, with not a single warning except this one. Being a conscientious developer I am keen to fix this problem so I have the warm fuzzies only a clean build can bring.

A: 

It seems like a bug in CDT.

If you really want to get rid of it, you should try getting rid of the spaces in the project path; this was suggested in a search result for the error. If that doesn't work, you can try to open the .cproject file -it's where all the CDT settings lie- and check for an actual path with duplicate entries.

aib
+12  A: 

This problem is a real pain to deal with. It doesn't work very well.

This is applicable to Eclipse 3.4.1 / CDT 5.0.1

From what I can tell, when you create a "C/C++ Project" within CDT, it will try to auto-detect your include paths. Great idea, but the implementation is horrid.

If you delete or rename a directory, the old directory is leftover. If you rename the project, the old directory is leftover. When Eclipse can't find that old directory, it gives you that warning.

My solution is turning the automated discovery off entirely and managing my include paths manually. You need this list of include paths for things like ctrl-click (auto-navigate to defines/functions/files/etc) and shading out #define blocks. It builds the index off this list.

Here's what you need to do: Right click on your project in the project explorer and go to properties. Go to C/C++ Build -> Discovery Options Uncheck "Automate discovery of paths and symbols"

Now go to C/C++ General -> Paths and Symbols You'll see under the Includes tab Assembly, C and C++ languages with corresponding auto-discovered include directories. Go to all 3 languages and delete everything. Open your makefile and transcribe your includes into the corresponding language. A project rename will still cause the indexer to break. ${project_name} and other globals do not seem to work. If you're having trouble, use the "Workspace" button to browse to the directory you want to include, as that seems to always work but entering it manually does NOT. Hit apply, then OK. Right click your project, go to index->rebuild Restart eclipse.

This should fix things forever. Any time something improperly is shaded out due to a #define or #ifdef block, it's because that list of files is outdated. You'll also know that list is outdated if you get "unresolved inclusions" on #include lines.

Doug Schaefer, hopefully Google indexes this, you find your name, and you fix this awful implementation. =)

Jeff Lamb
Just as an update, you can use the ${ProjName} variable in place of the actual project name and it will persist through a project rename.
Jeff Lamb
+2  A: 

I found this bug report to help my problem. I had moved some include paths and couldn't get rid of the old paths.

I've seen this problem too, old paths are never deleted. To manually fix the file you need to move/delete the ${projectname}.sc file found under ${workspace}/.metadata/.plugins/org.eclipse.cdt.make.core

https://bugs.eclipse.org/bugs/show_bug.cgi?id=206372

EJ
A: 

I have tried the workarounds suggested in the previous answers, and still have the warning. Is there anything else I can try?

A: 

You should check if you have manually defined a symbol that eclipse can figure out from your makefile. I have a project that has a manually written makefile and the problem was solved by removing symbols that I had manually added to C/C++ General -> Paths and Symbols -> Symbols.

Dick
A: 

I am working with Eclipse 3.4.2 and CDT 5.0.2, and I have the same problem. I cannot present a solution (I would be happy if anybody did -- none of the above worked for me), but I would like to mention that when trying the first solution above (by Jeff Lamb), as a result Eclipse deleted my entire workspace/.metadata directory, with all its contents. I was not able to open a single project after restarting Eclipse.

I strongly recommend that whoever tries the same solution make a backup of .metadata before.

Johannes Goller
A: 

Hi,

what does it mean

Open your makefile and transcribe your includes into the corresponding language

What do I have to write in my makefile?

Best regards Björn Schorre

Björn Schorre