Clean Eclipse Index, it is out of sync with code
Right-click on your project, go under the Index submenu, and choose either "Rebuild," "Update with modified files," or "Freshen all files."
I don't know the difference between those three options, but one of "Update with modified files" or "Freshen all files" usually fixes it for me.
Also, I'm sure you've already done this, but make sure that you're running the latest version of the Eclipse CDT. Current versions seem to have much more reliable indexing than previous versions.
Avoiding resource is out of sync with the filesystem
You can enable this in Window - Preferences - General - Workspace - Refresh Automatically (called Refresh using native hooks or polling in newer builds)
The only reason I can think why this isn't enabled by default is performance related.
For example, refreshing source folders automatically might trigger a build of the workspace. Perhaps some people want more control over this.
There is also an article on the Eclipse site regarding auto refresh.
Basically, there is no external trigger that notifies Eclipse of files changed outside the workspace. Rather a background thread is used by Eclipse to monitor file changes that can possibly lead to performance issues with large workspaces.
Eclipse cleanup - what are the .index files - can I safely delete them?
Yes, you can safely delete them, but it is not very useful.
According to an answer to How would you access Eclipse JDT index?, these files are the class index used when you "Open Type..." (in Refactor>Open Type... or via Ctrl+Shift+T). So if you delete them, next time you want to open a class using "Open Type..." the classes will be reindexed.
Therefore, deleting it for the sake of saving space has little sense, as it will be re-created. Deleting is however useful if you think you have something messed up in your index, it is a way to update it, as the refered answer suggests.
Clean out Eclipse workspace metadata
There is no easy way to remove the "outdated" stuff from an existing workspace. Using the "clean" parameter will not really help, as many of the files you refer to are "free form data", only known to the plugins that are no longer available.
Your best bet is to optimize the re-import, where I would like to point out the following:
- When creating a new workspace, you can already choose to have some settings being copied from the current to the new workspace.
- You can export the preferences of the current workspace (using the Export menu) and re-import them in the new workspace.
- There are lots of recommendations on the Internet to just copy the
${old_workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings
folder from the old to the new workspace. This is surely the fastest way, but it may lead to weird behaviour, because some of your plugins may depend on these settings and on some of the mentioned "free form data" stored elsewhere. (There are even people symlinking these folders over multiple workspaces, but this really requires to use the same plugins on all workspaces.) - You may want to consider using more project specific settings than workspace preferences in the future. So for instance all the Java compiler settings can either be set on the workspace level or on the project level. If set on the project level, you can put them under version control and are independent of the workspace.
Eclipse-cdt to index my C++ code only
Yes, I currently use Eclipse as an editor with its index on a project that is built outside of eclipse. Just turn off all the automatic build options in the project, and it will still index the code for you whenever a file changes. My project uses a bunch of special scripts to perform the build, so I just left it as a default c++ project from existing code, using the CDT builder when I created the project.
Eclipse CDT project with armadillo - CDT does not recognize 'arma' namespace
This question's answer provided the answer to my issue:
Clean Eclipse Index, it is out of sync with code
Josh Kelley's answer from the linked issue:
Right-click on your project, go under the Index submenu, and choose either "Rebuild," "Update with modified files," or "Freshen all files."
I don't know the difference between those three options, but one of "Update with modified files" or "Freshen all files" usually fixes it for me.
Also, I'm sure you've already done this, but make sure that you're running the latest version of the Eclipse CDT. Current versions seem to have much more reliable indexing than previous versions.
After running Index >> Rebuild and Index >> Freshen All Files, the errors were gone.
Enable C++11 in Eclipse CDT (Juno/Kepler/Luna) indexer
Note that this question (and answer) only deals with the Eclipse indexer which is used to highlight errors before compilation takes place. The C++ compiler settings are not changed! (Thus, compilation could still fail because of missing C++11 settings, but have a look at the "Related" section)
To change the Eclipse indexer settings go toProject properties
-> C/C++ General
-> Preprocessor Include Paths, Macros etc.
-> tab Providers
-> CDT GCC Built-in Compiler Settings
and append -std=c++0x
(or -std=c++11
) to Command to get compiler specs:
Afterwards it should look something like:
${COMMAND} -E -P -v -dD ${INPUTS} -std=c++0x
Sources
- http://wiki.eclipse.org/CDT/User/FAQ#CDT_does_not_recognize_C.2B.2B11_features
- http://www.eclipse.org/forums/index.php/mv/msg/373462/909018/#msg_909018
Related
- Eclipse CDT C++11/C++0x support
- https://stackoverflow.com/a/17499266/760746 (C++11-enable the compiler (Kepler and before))
- https://stackoverflow.com/a/22480299/760746 (C++11-enable the compiler (Kepler (updated) and newer)
Update
Successfully tested with Eclipse
- Kepler (CDT 8.2)
- Luna (CDT 8.4)
Related Topics
How to Check If a Function Exists in C/C++
Fast Divisibility Tests (By 2,3,4,5,.., 16)
Why and How to Use Namespaces in C++
Is Boost Shared_Ptr <Xxx> Thread Safe
How to Create a C++ Boost Undirected Graph and Traverse It in Depth First Search (Dfs) Order
How to Determine the Amount of Linux System Ram in C++
Can't Find Windows Forms Application for C++
Creating Array of Objects on the Stack and Heap
Safer But Easy-To-Use and Flexible C++ Alternative to Sscanf()
How to Use Libraries Compiled with Mingw in Msvc
Difference Between A* Pa = New A; and A* Pa = New A();
How to Take Screenshot in Opengl
How to Simulate a Mouse Movement
Fastest Way to Convert String to Binary
Why Must Std::Sort Compare Function Return False When Arguments Are Equal