Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] How to use CDT lib/java source
  • From: Ming Cheng <chengm349@xxxxxxxxxxx>
  • Date: Mon, 11 Nov 2019 09:52:21 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; 1; spf=none; dmarc=none; dkim=none; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed;; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gkcWz+UOFaZ0jg57+jbBgcNg79/2Tk0L7WKWgETEFK0=; b=BJu+LvwLf0jVitYXWEtPXsnF1Aq4BFLCky4ewImVZVucAaPjDaz9kIc1JDICXVS0FJFbRKIzdbYEqxwL8LilX+iW0BBq5YXaA6PuY+6DKxV8MF7WK85bFYBqPr5MOP05IPXI3idQA2Qogxh2LwXRCYX982hXX77Ipebmco5nmJkqFAulmw+0ttZI2yoPSvcZE/Hg23g9Rb2hZ7h9bRfBbIntsz+PfMy8fXSmum/8/ONJcIBP6C9RObo8j+Vz1kBw5gtLJe3VLnysusft74XnODSpFX4nmHrdulp1yM6jK6aAixgrjgCxpry1rgsgddRXLY4R9W81vrdSNOQTTCEIVQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901;; cv=none; b=MLNuGxd+jmwwZPvBX/3vvkW1Em5jcYdeNvebkcSUh3jeRX2Vj0xL92epu9fyO+wzrK/IazLTjo8x9lpbs+dEFWala0a+P3HIdcFLuoY8MXChGBQanwaQZnGpVLWq9k0d8kMWb22mxikpQs3AiRsCocqcyhTkhb4mdNbwj2DNKZOp/RsBjoWdL7i8ccPcUlzw1iGsTFIq3Z4ZXqdyI4vy/NEOA4AjCWl9T4i24B1HRfmbDNi5qnyscCyUI3NV5yLwnr9GEpGjc1AZBouYsYWw4lsye0cOmd9DmMCvVmcpFm4n8TIN/pSlWpTKPcapTarbxIP+5MK//gnV/IUsYpthuw==
  • Delivered-to: cdt-dev@xxxxxxxxxxx
  • List-archive: <>
  • List-help: <>
  • List-subscribe: <>, <>
  • List-unsubscribe: <>, <>
  • Thread-index: AQHViWZ0R32gYYOp2UKg+91RKq/2Xqdt3aUAgBfy7cc=
  • Thread-topic: [cdt-dev] How to use CDT lib/java source

Hi Marc-André


I for CDT from git:// When I tried to build it, I got following error:


“Failed to execute goal org.eclipse.tycho:tycho-packaging-plugin:1.4.0:build-qualifier (default-build-qualifier) on project org.eclipse.cdt.core.native: Working tree is dirty.

git status core/org.eclipse.cdt.core.native:


Changes not staged for commit:

modified:    core/org.eclipse.cdt.core.native/


You are trying to use tycho-buildtimestamp-jgit on a directory that has uncommitted changes (see details above).

Either commit all changes/add files to .gitignore, or enable fallback to default timestamp provider by configuring

jgit.dirtyWorkingTree=warning for tycho-packaging-plugin”


Although I did not touch the folder.


Is there anyway I can get a complete CDT jar file Eclipse?


Following your kind suggestion, if I want to create my first ASTNode of main(),


How to achieve the effect of “new IASTFunctionDefinition()”.  ?    It seem new Function is not the way because IFunction is not IASTNode.


According to the

I think I should create a ICPPASTTranslationUnit first. Some internet sample shows


ITranslationUnit tu = (ITranslationUnit)


ITranslationUnit tu = (ITranslationUnit)


  1. ITranslationUnit tu = (ITranslationUnit) CDTUITools.getEditorInputCElement(editor.getEditorInput());
  2. ITranslationUnit tu= (ITranslationUnit) CoreModel.getDefault().create(file);

I don’t have (need) UI Editor, and assume I just start my UML tool, so neither a src file; so how to create a tu? BTW how many different ways to create tu?



Sent from Mail for Windows 10


From: cdt-dev-bounces@xxxxxxxxxxx <cdt-dev-bounces@xxxxxxxxxxx> on behalf of Marc-Andre Laperle <malaperle@xxxxxxxxx>
Sent: Sunday, October 27, 2019 11:40:06 AM
To: CDT General developers list. <cdt-dev@xxxxxxxxxxx>
Subject: Re: [cdt-dev] How to use CDT lib/java source
Hi Ming,

One way would be to use the AST writing capabilities of CDT. This allows you to create nodes, insert them, etc then generate the code from this new AST. There are several places in the CDT codebase that use that, namely the refactorings which are mostly in org.eclipse.cdt.internal.ui.refactoring.* packages, see
There are also smaller spots in “quick fix” in package org.eclipse.cdt.codan.internal.checkers.ui.quickfix, see

I found this presentation about CDT refactoring, there are a few slides about creating AST nodes (node factory), ASTRewrite and generating changes that might useful to you:

About how to use this within your tool, it will depend a lot on how close your tool is to being an Eclipse plugin running in a workspace with a C/C++ project. If some of those conditions are not met, you will have a few more hurdles, like having to add all cdt.core dependencies on the classpath, figuring out if you can do AST writing on an external file (non-workspace), etc.

Either way, it sounds like an interesting project and something that you could write about in a blog or developer FAQ if you do manage to get it working.


On Oct 23, 2019, at 1:58 AM, Ming Cheng <chengm349@xxxxxxxxxxx> wrote:

Hi The team,
I want to develop C++ source code generator according to user’s diagram something like UML tool but very limited just for my needs. So my questions are:
  1. Can I call CDT lib’s API to generate C++ class/functions?
  2. What’s the ABC steps so I can follow them to merge the lib into my tool to see some very basic features?
Ming Cheng.
Warm Regards
Sent from Mail for Windows 10
cdt-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

Back to the top