java - Eclipse CDT 新项目模板 - 如何添加包含路径?

标签 java c plugins eclipse-cdt

如何在 Eclipse CDT 新项目模板的包含路径中添加自定义文件夹?

我在 template/template.xml 中使用以下标签但不起作用 -

<process type="org.eclipse.cdt.managedbuilder.core.AppendToMBSStringListOptionValues">
    <simple name="projectName" value="$(projectName)" />
    <complex-array name="resourcePaths">
        <element>
            <simple name="id" value="gnu.c.compiler.option.include.paths" />
            <simple name="value" value="/home/utkarshmankad/Documents/Ubimote/Lab_Experiments/sdk" />
            <simple name="path" value="" />
        </element>
    </complex-array>
</process>

运行上面编写的代码时,错误显示 - 参数不匹配类型:resourcePaths。带有以下错误日志 -

Argument type mismatch: files Argument type mismatch: files No Condition--> Process 1 (org.eclipse.cdt.managedbuilder.core.NewManagedProject)-->Success: Executed successfully with args: [name:test1, location:/home/utkarshmankad/runtime-EclipseApplication, artifactExtension:exe, isCProject:true] No Condition--> Process 2 (org.eclipse.cdt.core.CreateSourceFolder)-->Success: Executed successfully with args: [projectName:test1, path:src] No Condition--> Process 3 (org.eclipse.cdt.core.AddFiles)-->Success: Executed successfully with args: [projectName:test1, files:{{source:src/basename.c, target:src/test1.c, replaceable:true}, {source:Makefile, target:Makefile, replaceable:false}, {source:Makefile.test, target:Makefile.test, replaceable:false}}] No Condition--> Process 4 (org.eclipse.cdt.ui.OpenFiles)-->Success: Executed successfully with args: [projectName:test1, files:{{target:src/test1.c}}] No Condition--> Process 5 (org.eclipse.cdt.managedbuilder.core.SetMBSStringOptionValue)-->Success: Executed successfully with args: [projectName:test1, resourcePaths:{{id:.compiler.option.dialect.std., value:ISO C99 (-std=c99), path:}}] No Condition--> Process 6 (org.eclipse.cdt.managedbuilder.core.SetMBSBooleanOptionValue)-->Success: Executed successfully with args: [projectName:test1, resourcePaths:{{id:.compiler.option.warnings.extrawarn., value:true, path:}}] No Condition--> Process 7 (org.eclipse.cdt.managedbuilder.core.SetMBSStringOptionValue)-->Success: Executed successfully with args: [projectName:test1, resourcePaths:{{id:.compiler.option.misc.other., value:-c -fmessage-length=0 -Werror, path:}}]

请帮助我在包含路径中添加自定义包含文件的正确方法?

最佳答案

我终于找到了解决问题的方法。

这在博客文章的帮助下成为可能 - https://www.sevenwatt.com/main/eclipse-cdt-plug-ins-new-cc-project-templates/

并且很少挖掘简单的 C 项目的隐藏 .cproject 文件。识别id值。

您必须输入这段代码来添加电脑中的任何文件夹,以将其添加到包含搜索路径 -

<process type="org.eclipse.cdt.managedbuilder.core.AppendToMBSStringListOptionValues">
    <simple name="projectName" value="$(projectName)" />
    <complex-array name="resourcePaths">
        <element>
            <simple name="id" value="gnu.c.compiler.option.include.paths" />
            <simple-array name="values">
                <element value="&quot;/home/utkarshmankad/Documents/Ubimote/Lab_Experiments/sdk/bsp/&quot;" />
                <element value="&quot;/home/utkarshmankad/Documents/Ubimote/Lab_Experiments/sdk/drivers/&quot;" />
            </simple-array>
            <simple name="path" value="" />
        </element>
    </complex-array>
</process>

在这里,我通过添加多个标签添加了多个包含搜索路径。 如果您只想包含一个包含路径,则只保留一个元素路径。

关于java - Eclipse CDT 新项目模板 - 如何添加包含路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49856386/

相关文章:

c - 尝试 malloc 时具有特定输出的 Valgrind 泄漏和段错误

java - Mongo - 我无法使用 java-mongo 3.5 驱动程序保存 Pojo(如果它包含 Map<String,Object> 或 Document 字段)

java - findFragmentById 在特定 Activity 中返回 null

arrays - C编程: printing a null-terminated string using a character pointer

cygwin 上使用 FD_SET() 和消息队列进行核心转储

jenkins - java.nio.file.NoSuchFileException :/target/classes/META-INF/annotations/hudson. 构建 Jenkins 插件时的扩展

ruby-on-rails - 捆绑安装错误 : Source does not contain any versions of

eclipse - 如何在eclipse 中安装javax 和apache 插件?

Java Socket - 从线程更新实例变量列表

java - 正则表达式匹配特定字符串或数字