1

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?

1 Answer 1

4

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.