| Help setting CDT Indexer include path programmatically [message #821762] |
Thu, 15 March 2012 15:46  |
Presanna Raman Messages: 2 Registered: March 2012 |
Junior Member |
|
|
Hi,
I am new to developing using CDT plug-in. I am currently using Eclipse Indigo to develop my plug-in. I was planning on making use of the features automatically available with CDT - content assist, error reporting, etc. But CDT always reports syntax errors - "Type '<Variable>' could not be resolved" and annotates the source for all definitions and variables unless they are defined in the same source file. This makes code readability very difficult. The project build successfully as it has its own build files where the Include path is correctly referenced..
I presume that this is due to the CDT indexer not having all the include paths available to it. I want to know how I can provide CDT with the include paths programmatically. It is not possible to provide the include paths via preferences as there are a lot of modules and they change across projects.
I looked online for a way to programmatically set the include path but I was not able to find any help or instructions. Any help with this will be appreciated.
With Regards,
Presanna Raman.
P.S. I have attached image of what I see in the editor. Note: The INT32 macro is resolved while the rest are not.
|
|
|
|
| Re: Help setting CDT Indexer include path programmatically [message #829510 is a reply to message #821830] |
Mon, 26 March 2012 07:41   |
Slavian Petrov Messages: 2 Registered: March 2012 |
Junior Member |
|
|
Hi Raman,
I have a similar issue with my plugin.
After a search in the CDT sources I found something that is working for me in:
Project: org.eclipse.cdt.ui
Class: org.eclipse.cdt.internal.ui.wizards.settingswizards#readSettings()
This is finally how I made it:
IProject project = ...
ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescription(project, true);
ICConfigurationDescription configDecriptions[] = projectDescription.getConfigurations();
for (ICConfigurationDescription configDescription : configDecriptions) {
ICFolderDescription projectRoot = configDescription.getRootFolderDescription();
ICLanguageSetting[] settings = projectRoot.getLanguageSettings();
for (ICLanguageSetting setting : settings) {
if (!"org.eclipse.cdt.core.g++".equals(setting.getLanguageId()))
continue;
List<ICLanguageSettingEntry> includes = new ArrayList<ICLanguageSettingEntry>();
includes.addAll(setting.getSettingEntriesList(ICSettingEntry.INCLUDE_PATH));
includes.add(new CIncludePathEntry("/my/local/include/path", ICSettingEntry.LOCAL));
setting.setSettingEntries(ICSettingEntry.INCLUDE_PATH, includes);
}
}
CoreModel.getDefault().setProjectDescription(project, projectDescription);
[Updated on: Mon, 26 March 2012 07:56] Report message to a moderator
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01785 seconds