【问题标题】:keil compiler error - can not open source input file - but file existskeil编译器错误-无法打开源输入文件-但文件存在
【发布时间】:2017-01-23 19:34:38
【问题描述】:

我在 Keil 5 中编译 使用 armcc:

*** Using Compiler 'V5.06 (build 20)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'

我收到以下错误:

compiling softdevice_handler.c...
"no source": Error:  #5: cannot open source input file "..\..\..\..\..\..\components\softdevice\common\softdevice_handler\softdevice_handler.c": No such file or directory
..\..\..\..\..\..\components\softdevice\common\softdevice_handler\softdevice_handler.c: 0 warnings, 1 error

我确定源 c 文件存在。我在 GUI 中添加了它,我可以在 GUI 中打开它。

那么,如果文件确实存在,为什么编译器会抱怨文件不存在呢?

【问题讨论】:

    标签: path compiler-errors window


    【解决方案1】:

    好的,我发现问题是windows 7 path length limit of ~255 bytes

    结合 keil 编译器的愚蠢。它的作用是结合 项目路径+相对资源路径。比如:

    project path: projects/projectX/toolchain/keil5/projectX.uvprojx
    src path is : projects/projectX/src/a/b/src.c
    

    那么armcc内部使用的是:

    projects/projectX/toolchain/keil5/../../a/b/src.c
    

    它增加了额外的:

     /toolchain/keil5/../../
    

    所以即使 src.c 不是太深,当你总结项目路径的一部分时,它可以超过 255 个字符。

    arm 的解决方案是转到:Project->options->C/C++->Misc Controls 并添加“--reduce_paths”。见keilarmcc manual

    另一种选择是将项目复制到更靠近根文件夹的位置,以减少最大项目路径。

    【讨论】:

      猜你喜欢
      • 2014-09-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-22
      • 1970-01-01
      相关资源
      最近更新 更多