Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » API to attach header files to a C project in Eclipse CDT
API to attach header files to a C project in Eclipse CDT [message #910649] Mon, 10 September 2012 06:45
sangram reddy is currently offline sangram reddyFriend
Messages: 2
Registered: September 2012
Junior Member
We made an Eclipse CDT plugin in order to create a C project layout that follow certain standard set across our organization. We maintain some sort of XML files that define the project/product dependencies. That means, every product will have an XML file that defines what source files/headers goes into that product.

So, when importing a C project in Eclipse CDT, instead of following the standard CDT project setup, our plugin takes product name as the input and parses the product's XML to generate a C project with appropriate source files.

We were able to attach source files to the C project using the following API and Linked Resources concept in Eclipse.


We were also able to attach header files to the same C project using the following class.


Note: We created IIncludeEntry instances with the inlcude directories as the input. Eclipse's scanner discovery mechanism is identifying the individual source files inside each directory and showing them under "Includes" tag in C project.

Now the source files are shown under "Source" tag and the header files are shown under "Includes" tag in the C project. We could modify and build the source files without any issues.

However, we couldn't edit any of the header files. If I manually add an external header file thru Project >> Properties >> C/C++ General >> Paths and Symbols everything works fine, we can edit the files.

I also tried to use org.eclipse.cdt.core.model.IIncludeFileEntry instead of IIncludeEntry by giving individual header file paths to IIncludeFileEntry. But Eclipse isn't identifying anything with IIncludeFileEntry.

What's the CDT API to create/attach header files to a C project? How Eclipse CDT creates them?
Previous Topic:Template template parameter works in cpp file but not in header
Next Topic:iostream file is not found
Goto Forum:

Current Time: Sun May 27 05:29:52 GMT 2018

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

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

Back to the top