Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Using translationUnit.createInclude to add #include directives


I am trying to use the CDT 5.0 API to insert an #include directive in a source file.

I am using a call like this one:
translationUnit.createInclude( includeString, false, null, new NullProgressMonitor() );

The documentation says that this should insert the include after the other includes, and if it is already added it won't add it again (avoids duplicate #includes).

I see 2 problems:
1) It inserts it on the same line as another #include directive (does not automatically insert a new line)
2) It adds duplicates

Does anyone know how to avoid those 2 problems? Is this a known issue that has been fixed in later versions of CDT?

Thank you for your help.

Best regards,

Back to the top