Reputation: 3802
I compiled in Keil 5 using armcc:
*** Using Compiler 'V5.06 (build 20)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
and I got following error:
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
I was sure that source c file exists. I added it in GUI and I could open it in GUI.
So why compiler complains that file does not exists if file does exists?
Upvotes: 1
Views: 9479
Reputation: 3802
Ok so I found that issue was windows 7 path length limit of ~255 bytes.
Combined with keil compiler stupidity. What it does is that it combines project path + relative resource path. So for example:
project path: projects/projectX/toolchain/keil5/projectX.uvprojx
src path is : projects/projectX/src/a/b/src.c
then what is used internally by armcc is:
projects/projectX/toolchain/keil5/../../a/b/src.c
it adds extra:
/toolchain/keil5/../../
So even if src.c is not too deep, it can go over 255 characters when you sum part of project path.
Solution for arm is to go to: Project->options->C/C++->Misc Controls
and add "--reduce_paths
". See keil armcc manual.
Another option is to copy project closer to root folder so maximum project path is reduced.
Upvotes: 5