错误1:制作c文件时没有输入文件 [英] Error 1: no input files when making a c file
问题描述
我试图编译一个具有依赖关系的c文件,使用的makefile会遇到此错误:
I'm trying to compile a c-file with dependencies, using a makefile that gets stuck with this error:
Compiling tpc_lqe.o ...
/cygdrive/c/Sandbox/ZigBee/Tools/ba-elf-ba2/bin/ba-elf-gcc -c -o tpc_lqe.o
[some -options]
-I/cygdrive/c/Sandbox/ZigBee/Components/TPC/Include
-I/cygdrive/c/Sandbox/ZigBee/Components/TPC/Source
-I/cygdrive/c/Sandbox/ZigBee/Components/AppApi/Include
-I/cygdrive/c/Sandbox/ZigBee/Components/Common/Include
-I /cygdrive/c/Sandbox/ZigBee/Components/TPC/Source/tpc_lqe.c -MD -MF tpc_lqe.d -MP
ba-elf-gcc: no input files
make: *** [tpc_lqe.o] Error 1
Makefile:138: recipe for target 'tpc_lqe.o' failed
I saw other questions regarding the same error, but I can't relate to them with my problem.
这是造成错误的makefile行,如果缺少某些上下文,请指出:
This is the makefile line that is causing the error, please point out if some context is missing:
%.o: %.c
$(info Compiling $@ ...)
$(CC) -c -o $*.o $(CFLAGS) $(INCFLAGS) $< -MD -MF $*.d -MP
更新 放松回答:
我没有包括指定一个变量(库的包含路径),这导致以下包含该变量(INCFLAGS)包含空格的替代。这个空格以-I选项结束,因此返回错误。
I didn't include specify a variable (include path of a library), which caused the following inclusion of that variable (INCFLAGS) to contain a blank space in its stead. This blank space ended up in the -I option thus returning the error.
一旦定义了这个变量,一切都顺利。
Once defined that variable, everything worked smoothly.
推荐答案
INCFLAGS
看起来破碎,因为编译器调用有一个裸 code>,没有紧接着的值,这导致gcc将下一个参数(源文件名)解释为该参数:
INCFLAGS
looks broken, since the compiler invocation has a "bare" -I
, without a value immediately following, which causes gcc to interpret the next argument (the source file name) as that argument:
[...] -I /cygdrive/c/Sandbox/ZigBee/Components/TPC/Source/tpc_lqe.c
^
|
???
这篇关于错误1:制作c文件时没有输入文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!