【问题标题】:Eclipse CDT Templates - Set the Compiler's Name?Eclipse CDT 模板 - 设置编译器的名称?
【发布时间】:2014-04-03 01:04:27
【问题描述】:

默认设置是“gcc”。但是说我的编译器的名字是'my_gcc',链接器'my_gcc'和汇编是'my_as。

你到底是怎么用模板设置的??

会认为你会做以下事情:

<process type="org.eclipse.cdt.managedbuilder.core.SetMBSStringOptionValue">
    <simple name="projectName" value="$(projectName)" />

    <complex-array name="resourcePaths">
        <element>
            <simple name="id" value="cdt.managedbuild.tool.gnu.cross.c.compiler" />
            <simple name="value" value="my_gcc" />
            <simple name="path" value="" />
        </element>
    </complex-array>
</process>

这些属性我需要在别处设置吗??

【问题讨论】:

  • 更新 - 为了解决这个问题,我必须制作一个完整的自定义工具链。糟糕。

标签: java eclipse plugins eclipse-cdt


【解决方案1】:

找不到基于模板的解决方案;但这是一个程序化的解决方案:

//assumptions
//#1 project  is [0] in workspace
//#2 compiler is [2] in workspace

//get project
IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject("hello_world");

//get <storageModule moduleId="org.eclipse.cdt.core.settings">
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(proj);

//get <storageModule moduleId="cdtBuildSystem">
IManagedProject sub_info = info.getManagedProject();

//get <configuration name="Debug">
IConfiguration config = sub_info.getConfigurations()[0];

//get <toolChain>
IToolChain toolchain = config.getToolChain();

//get <tool name="GCC C Compiler">
ITool tool = toolchain.getTools()[2];

//-----update command----//
ManagedBuildManager.setToolCommand(config, tool, "my_gcc");
ManagedBuildManager.saveBuildInfo(proj, true);

然后对您需要修改的每个工具重复一遍。

【讨论】:

    猜你喜欢
    • 2019-03-01
    • 2011-01-21
    • 2018-01-28
    • 2016-01-20
    • 1970-01-01
    • 2011-02-18
    • 1970-01-01
    • 2011-03-18
    • 1970-01-01
    相关资源
    最近更新 更多