在没有Eclipse的情况下使用CDT [英] Using CDT without Eclipse

查看:130
本文介绍了在没有Eclipse的情况下使用CDT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在项目中使用CDT解析器。该项目将是一个命令行独立项目,即不是Eclipse插件。

I want to use CDT parser in a project. The project would be a command-line, stand-alone project, i.e., not an Eclipse plugin.

我见过的所有解决方案都需要使用 IWorkspace 。但是,我想在Eclipse之外的单个文件上使用CDT解析器。有什么办法吗?

All solutions that I've seen requires using a IWorkspace. But, I want to use the CDT parser on single files outside eclipse. Is there any way to do that?

推荐答案

这取决于您没有Eclipse的含义。

It depends what you mean by "without Eclipse".

CDT的代码建立在Eclipse平台之上,因此您将需要运行一个包含Eclipse平台的应用程序。但是,没有理由应用程序不能成为命令行应用程序。在Eclipse社区中,这些应用程序被称为无头应用程序,您可以找到许多教程来制作一个(这里是一个)。

CDT's code is built on top of the Eclipse Platform, so you're going to need to be running an application that includes the Eclipse Platform. However, there's no reason that application can't be a command-line application. These are called "headless" applications in the Eclipse community, and you can find many tutorials for making one (here's one).

需要 IWorkspace 不应该问题。您可以例如在一个临时文件夹中创建一个工作区和一个项目,然后在其中复制要分析的代码。

Requiring an IWorkspace shouldn't be a problem. You can e.g. create a workspace and a project in a temporary folder, and copy the code to be analyzed there.

如果出于某种原因,您真的只想在其中使用CDT的解析器,一个不包含Eclipse平台的应用程序,您可能可以从CDT复制解析器代码,并用自己的实现替换它在Eclipse平台上具有的所有依赖关系。但是,这可能是一种劳动密集型的方法,我不建议这样做。

If, for some reason, you really want to use just CDT's parser in an application that doesn't include the Eclipse Platform, you can probably copy the parser code from CDT, and replace any dependencies it has on the Eclipse Platform with your own implementations. However, this is likely to be a more labour-intensive approach, and I wouldn't recommend it.

这篇关于在没有Eclipse的情况下使用CDT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆