Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

refresh eclipse cdt system includes

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?

like image 719
user966085 Avatar asked Dec 20 '11 01:12

user966085


People also ask

How do you refresh in Eclipse?

Enabling Automatic File Refresh in Eclipse To set auto-refresh, go to window → preferences → general → workspace and check the "Refresh using native hooks or polling" check-box.

What is CDT for Eclipse?

The CDT is Eclipse's C/C++ Development Tooling project. It is an industrial-strength C/C++ IDE that also serves as a platform for others to provide value-added tooling for C/C++ developers.

How do I know if Eclipse CDT is installed?

Click 'Help > About Eclipse' and then click the 'Installation Details' button at the bottom of the dialog. The resulting dialog shows all the features you have installed on the 'Installed Software' tab.

How do you refresh a project programmatically in Eclipse?

To refresh all projects in a workspace, simply enumerate all projects using ResourcesPlugin. getWorkspace(). getRoot(). getProjects() API and refresh each in turn.


2 Answers

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++
like image 191
qethanm Avatar answered Oct 06 '22 00:10

qethanm


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.

like image 32
Joe Avatar answered Oct 06 '22 01:10

Joe