Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Problems when programmatically adding macros
Problems when programmatically adding macros [message #1068176] Fri, 12 July 2013 14:26
Thomas Kutz is currently offline Thomas KutzFriend
Messages: 4
Registered: July 2013
Junior Member
Hi all,

I'm currently trying to add own macro definitions by using the follwoing API:
ICLanguageSetting.setSettingEntries(ICSettingEntry.MACRO, myMacros)

However, it does not work for me, i.e. the macro entries are not set at all. Inside setSettingEntries(..) the condition in
if((kind & eKind) != 0 && (data.getSupportedEntryKinds() & eKind) != 0){
  store.addEntry(entry);
}

is never true because data.getSupportedEntryKinds() returns 48 => only ICSettingEntry.LIBRARY_PATH and ICSettingEntry.LIBRARY_FILE is supported. How can I change this? My observation is that, when running my product the attribute 'data' is of type BuildLanguageData. But, when running a JUnit test where I programmatically create a new C project, 'data' is of type CDefaultLanguageData. There, adding new macros works fine.

My code basically looks as following:
final ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
final ICProjectDescription des = mngr.getProjectDescription(file.getProject(), true);
final ICConfigurationDescription confDes = des.getDefaultSettingConfiguration();
final ICFolderDescription folderDescription = confDes.getRootFolderDescription();
final ICLanguageSetting[] languageSettings = folderDescription.getLanguageSettings();
for (final ICLanguageSetting lang : languageSettings) {
  lang.setSettingEntries(ICSettingEntry.MACRO, macroDefines);
}
des.setActiveConfiguration(confDes);
des.setCdtProjectCreated();
model.setProjectDescription(file.getProject(), des);


Any idea what I am missing here?

Regards,
Thomas
Previous Topic:Eclipse marks macros from inttypes.h as syntax errors
Next Topic:Installing CDT on ubuntu
Goto Forum:
  


Current Time: Sat Oct 12 20:02:31 GMT 2024

Powered by FUDForum. Page generated in 0.02964 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top