Skip to content

[bug] incList 中生成的包含路径多了一级 ../,导致编译找不到头文件 #564

Open

Description

@6617king

What are you doing?
Creating a new ARM GCC project and adding include paths via EIDE's configuration UI, then trying to build.
Describe the bug
The include paths generated in .eide/eide.yml incList have an extra ../ prefix, causing the compiler to resolve them relative to the parent directory of the project root. This results in fatal error: No such file or directory for all headers.
To Reproduce

  1. Create a new ARM GCC project in EIDE
  2. Open the project configuration → C/C++ Preprocessor → Include Paths
  3. Add a path like firmware/cmsis/inc
  4. Open .eide/eide.yml, observe incList shows ../firmware/cmsis/inc instead of firmware/cmsis/inc
  5. Click Build
  6. See error: fatal error: gd32h7xx_hal.h: No such file or directory
    Expected behavior
    The include paths in incList should be relative to the project root directory, matching the compiler's working directory. The ../ prefix should not be added.
    Screenshots
    N/A
    Desktop:
  • OS: Windows 10
  • EIDE Version: v3.27.2
  • VSCode Version: v1.98.0
    Additional context
    The root cause: EIDE computes incList paths relative to the .eide/ directory, but the compiler runs from the project root. For example, compile command shows -I../firmware/cmsis/inc when it should be -Ifirmware/cmsis/inc. Manually removing the ../ prefix from .eide/eide.yml fixes the build.

Activity

  1. github0null commented on Jul 15, 2026

    @github0null
    Owner

    并未发现问题。

    Image
  2. 6617king commented on Jul 15, 2026

    @6617king
    Author

    自动生成的eide.yml会在指定固件库的时候多一层 / 导致文件地址识别不到
    targets:
    GD_ARM_MCU_Debug:
    cppPreprocessAttrs:
    defineList:
    - GD32H7XX
    - GD_ECLIPSE_GCC
    - USE_STDPERIPH_DRIVER
    incList:
    - .../firmware/cmsis/inc
    - .../firmware/gd32h7xx_hal_peripheral/Include
    - .../inc

    libList: []
    excludeList: []
    settings: {}
    toolchain: GCC
    toolchainConfigMap:
    实际上应该是这样的
    targets:
    GD_ARM_MCU_Debug:
    cppPreprocessAttrs:
    defineList:
    - GD32H7XX
    - GD_ECLIPSE_GCC
    - USE_STDPERIPH_DRIVER
    incList:
    - firmware/cmsis/inc
    - firmware/gd32h7xx_hal_peripheral/Include
    - inc

    libList: []
    excludeList: []
    settings: {}
    toolchain: GCC
    toolchainConfigMap:
    导致文件在编译时找不到库
    这个项目是从 Eclipse CDT(GigaDevice MCU 插件) 导入到 EIDE 的。在 Eclipse 中,编译工作目录是 GD ARM MCU Debug/ 这样的子目录,所以包含路径写成 ..\firmware\cmsis\inc 是正确的(退回到项目根目录)。但 EIDE 导入时原样复制了这些路径到 .eide/eide.yml,而 EIDE 编译时工作目录是项目根目录,导致 ..\firmware... 跳到了项目上级目录,头文件找不到。

  3. github0null commented on Jul 15, 2026

    @github0null
    Owner

    你好

    • 请提供一下你的 .cproject 文件
    • 使用 tree 命令列出你的工程完整目录结构。

    原则上插件已经处理了 Eclipse 的工作目录

    if (p.startsWith('../')) p = p.substr(3); // for eclipse, include path is base 'Debug' folder

    如果没有生效可能是你的路径中含有 Eclipse 的环境变量

  4. 6617king commented on Jul 15, 2026

    @6617king
    Author

    ├─.eide
    ├─.settings
    ├─.vscode
    ├─build
    │ └─GD_ARM_MCU_Debug
    │ └─.obj
    │ ├─firmware
    │ │ ├─cmsis
    │ │ │ └─src
    │ │ └─gd32h7xx_hal_peripheral
    │ │ └─Source
    │ ├─gcc_startup
    │ └─src
    ├─firmware
    │ ├─cmsis
    │ │ ├─inc
    │ │ └─src
    │ └─gd32h7xx_hal_peripheral
    │ ├─Include
    │ └─Source
    ├─gcc_startup
    ├─inc
    ├─ldscripts
    ├─openocd_gdlink
    └─src

  5. 6617king commented on Jul 15, 2026

    @6617king
    Author
  6. github0null commented on Jul 16, 2026

    @github0null
    Owner
    Image

    路径分隔符似乎不太正确,一般的 eclipse 是统一使用 / 作为分割,不分平台。因此插件的当前导入流程仅假定路径中不含 \ 分隔

    插件后面会额外优化一下,目前你只能先手动修正

    Image

    以下是一些常见的 eclipse ide 配置

    stm32 cube
    Image

    gnu arm eclipse
    Image

    SimplicityStudio
    Image

    gnu mcu eclipse
    Image

  7. 6617king commented on Jul 16, 2026

    @6617king
    Author

    好的谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions