在没有Eclipse的情况下使用CDT

编程入门 行业动态 更新时间:2024-10-28 10:32:52
本文介绍了在没有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

本文发布于:2023-11-16 21:25:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1607522.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:情况下   Eclipse   CDT

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!