I have a self contained project where every included file is within the project itself.
In the project properties -> "C/C++ General" -> "Preprocessor Include Paths, Macros etc." -> "Providers" I disabled the entries I don't need, but something re-enables the "CDT Cross GCC Built-in Compiler Settings".
Is there a way to permanently disable this option?
I want to keep the indexer working, and also I have some entries in the CDT managed build entries so its not an option to get rid of the build configuration (I do not build/start the build of the project from Eclipse).
The automatically added includes conflicts with the files within my project messing up the indexer (it adds the MinGW includes).
I am using Eclipse Oxygen on Windows 7.
Related
I'm using Eclipse Kepler for C++, and I'm trying to update to C++11.
I've found that appending "-std=c++11" under C/C++ Build -> Settings -> Miscellaneous -> Other Flags will enable a specific project to run C++11. However, I have not been able to find a way to default this operation whenever a new project is created.
Is there a one-time setting that automatically sets a new C++ project to C++11? Thanks for letting me know.
I am using a quite large project in Eclipse, composed by different libraries which can be build independently thanks to dedicated "Make Target" elements.
When compiling one of this libraries, the compilation works fine, but afterwards, Eclipse keeps busy by doing "Building Targets. Updating projects..." (as named in the Progress View). As my project is rather large, this action takes several minutes, preventing me to start new compilations or change Eclipse settings.
Is there any way to disable this automatic update in Eclipse?
I have observed this behaviour in Eclipse Helios and Eclipse Juno.
I have tried to remove my "Make target" objects, and give an invalid C/C++ Build configuration (e.g., provide an invalid make command).
As expected, when building the project, Eclipse tries to execute the invalid make command (which fails), but then keeps doing this "Updating projects..." anyway...
After build Eclipse is looking for newly created executables. If your project is Makefile-based Eclipse cannot be sure where to search and browses the whole source tree.
Assuming your executable are all go into a folder bin-XXX, you can reduce these searches as following:
Select the top project (say "src") and go to the right-menu dialog “Properties” (alternatively: top menu Project-Properties). Then go to “C++ build”-“Refresh policy”. Here select the folder “src” and press “Add Exception”. Then add all folders except “bin-XXX” as an exception.
Select the top project “src” and go to the right-menu dialog “Properties” (alternatively: top menu Project-Properties). Then go to “C++ General – Paths and Symbols – Output Location”. Add folder “bin-XXX” and remove the folder “src”
I'm using ecipse cdt developing c++ program. A problem is I moved all my workspace and eclipse package from turbolinux to centos linux. Then it cause a problem, that is system includes are different, but eclipse didn't refresh the include paths. And all the std container classes can not be solved.
Anyone know how to fix this problem?
I was recently bitten by this one myself (actually came to this site in search of an answer ;-) so I'll share what I found:
(these steps reflect Eclipse Indigo SR1)
First, double-check that Eclipse still reflects the old include paths:
project -> properties -> C/C++ General -> Paths and Symbols -> GNU C++
Next, clear the old paths:
project -> properties -> C/C++ Build -> Discovery Options -> GCC C++ Compiler
click the button for "Clear discovered entries now"
Rebuild your project, such that Eclipse picks up on the new include paths
Confirm that the new include paths are set:
project -> properties -> C/C++ General -> Paths and Symbols -> GNU C++
Checked for Eclipse Luna 4.4.0 with Cdt 8.4.0.201406111759.
You may have a look to your workspace/.metadata/.plugins/org.eclipse.cdt.core/ and check for a file named like YourProjectName.language.settings.xml.
Delete this file (better should backup before), then reopen your project (or restart Eclipse) and Cdt should trigger the the GCC Builtin Discovery.
Note that this way may only applyable if your settings are set to project specific Builtin Discovery (not for »Use global provider shared between projects«). → see Project Properties → C/C++ General → Preprocessor Include Paths, Macros etc. → Providers → CDT GCC Built-in Compiler Settings.
For older Eclipse versions (IMHO about until Indigo), the scanner cache files were placed in workspace/.metadata/.plugins/org.eclipse.cdt.make.core/ and named like YourProjectName.sc.
In the newest Eclipse CDT Mars.1 Release (4.5.1) you'll have to delete the ${WORKSPACE}/.metadata/.plugins/org.eclipse.cdt.core/${PROJECTNAME}.randomnumbers.pdom file, and after opening the project, Eclipse should automatically start to reindex the includes.
In the build settings I have it define DEBUG when in the debug build configuration, so that I may make my code do separate things depending on which type of build it is.
However in Eclipse it darkens out the parts of the code which are excluded by the preprocessor, and this doesn't keep up when I change the setting (whether I'm currently building debug or release). So, I have a bunch of code which is perpetually darkened out, and the Eclipse indexer and other helpful features don't work inside of those areas.
How to fix? Has anyone else encountered this?
Update: Still having this issue. I eventually abandoned my unit-test build configs and simply put that functionality into a command-line switch. Just so that I could get indexing to work while I write my unit tests.
You have to set the option "Build configuration for the indexer" to "Use active build configuration" in the projects C/C++ indexer preferences. Open the properties panel for the project, go to c/C++ General and Indexer and enable project specific settings and change the radiobutton on the bottom to "Use Active build configuration".
Of course you can also set this in the global properties panel of Eclipse to change this setting for all projects.
Go to your project's Properties, then go to C/C++ General -> Paths and Symbols -> Symbols. Add your defines there and it will work.
If you want to change the defines for your system based on build configuration, you need to do as dgrant said here: "Project properties and select C/C++ General -> Paths and Symbols then select the Symbols tab", but you need to make sure you have the correct configuration selected at the top of your window. Also be sure when you add the symbol to the list that you DON'T check the "add to all configurations" checkbox.
If you want your correct set of symbols to be parsed by CDT in your editor, you'll also need to make sure you have the correct build configuration active as well. To do that, right-click on your project and select Build Configurations -> Set Active -> and select the build configuration you want to make active. CDT will now parse all the files as if this build configuration were active instead, using the global symbols you defined in the last step.
There is a problem I've seen with every version of Eclipse where it doesn't always decide to rebuild your index files immediately. To get it to do so, you can either start a build (the build doesn't actually have to complete), or you can right-click on your project and go to Index -> Rebuild. Both cause an immediate re-indexing to occur. You shouldn't need this, however. I can confirm that simply changing the build configuration as described in step 2 above will cause an #ifdef I have in my code which checks for a symbol defined only in one of my build configurations to immediately become greyed-out or un-greyed-out, as it should.
Check provider: -> C/C++ General -> Preprocessor Include Paths, Macros etc. -> Providers -> CDT Managed Build Settings Entries. It should be enabled.
Check if defined symbol is in entries of this provider.
Indexer is optional.
My satisfactory solution has been to move away from Eclipse to editors with a working libclang plugin: Sublime Text, Vim.
For an intelligent IDE for C/C++, one probably can't go wrong with XCode or MSVC.
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.
This worked for me with Eclipse 3.7.2 and CDT 8.0.2:
Open the project properties | C/C++ Build | Discovery Options.
Click the button by Clear discovered entries now:.
Rebuild.
It is seems to be a new feature in CDT 8. I have had this "Invalid project path: Duplicate path entries" problem for years, and this is apparently the newly provided solution.
Before doing this there were duplicate paths under C/C++ General | Paths and Symbols | Includes tab. I could not get rid of these. They only appear when Show built-in values is checked, so they are apparently generated somehow. After doing the above they were replaced with a set that did not have duplicates. The only difference is that the same settings appeared under Assembly, GNU C, and GNU C++. Previously they were different sets. The ones for Assembly were empty, for example.
So far the problem has not returned.
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. =)
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
Using Eclipse Luna and CDT 8.5
I fixed the issue by
Open the project properties | C/C++ General | Paths and Symbols
Look at the Source Location tab, I had renamed a directory and it was not updated in this list.
Rebuild
Here I just found another way to re-detect the path automatically:
Open "Workspace Settings-> C/C++ -> Build -> Settings -> Discovery"
Find "CDT Build-in Compiler Settings [Shard]"
Click "Clear Entries" and "Reset" button on the right
Rebuild projects and Done
Hope this will help.
Reference:
http://qing.blog.sina.com.cn/1802712302/6b7334ee33004def.html
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.
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.
No needs to remove .metadata guys, just delete all path located in C/C++ General -> Paths and Symbols -> Symbols and replace them on using click buttom but don't give the path manually
Here's a late answer for Eclipse 4.4 (which does not have a Discovery option).
Delete the project's infoPath file. Eclipse or the ADT plugin (not sure which) will recreate it, and populate it with the correct paths.
You can find the project's infoPath file at <Eclipse workspace>/.metadata/.plugins/com.android.ide.eclipse.ndk/<project>.pathInfo.
I think Eclipse or the ADT plugin determines the new paths from two places: (1) the NDK directory set under Eclipse preferences, and (2) paths in Application.mk. All those paths become "Built-in" paths under Eclipse.
Also see How to change built-in C/C++ paths pointing to a deleted android-ndk-r9 installation?