用于将 .o 文件转换为 .elf 的链接参数
我有六个源文件,我想使用 .elf
格式链接它们。我编写了一个 makefile,将所有源代码文件转换为 .obj 文件。
当我尝试使用我在 makefile 中给出的语法链接这些目标文件时,会出现以下错误:
gcc -c rt_look.c
Linking ARM test_rom.elf
make[1]: o: Command not found
make[1]: [test_rom.elf] Error 127 (ignored)
make[1]: Leaving directory `/c/Imperas/Demo/main/isolated_model_ert_rtw
我还粘贴了 makefile 规则:
all:$(OBJ) test_rom.elf
ert_main.o: ert_main.c isolated_model.h rtwtypes.h
gcc -c ert_main.c
isolated_model.o: isolated_model.c isolated_model.h isolated_model_private.h
gcc -c isolated_model.c
isolated_model_date.o: isolated_model_data.c isolated_model.h isolated_model_data.h
gcc -c isolated_model_data.c
rt_look2d_normal.o: rt_look2d_normal.c rtlibsrc.h
gcc -c rt_look2d_normal.c
rt_nonfinite.o: rt_nonfinite.c rt_nonfinite.h
gcc -c rt_nonfinite.c
rt_look.o: rt_look.c rtlibsrc.h
gcc -c rt_look.c
syscalls.o: syscalls.c
gcc -c syscalls.c
test_rom.elf: $(OBJ)
$(V) echo "Linking $(CROSS) $@"
$(V) $(IMPERAS_LINK) -o $@ $^ $(IMPERAS_LDFLAGS) -lm
clean::
-rm -f test_rom.elf
-rm -f *.$(OBJ).o
endif
I have six source files and I would like to link them using the .elf
format. I have written a makefile that converts all the source code files to .obj files.
When I attempt to link these object files using the syntax I gave in the makefile, the following errors appear:
gcc -c rt_look.c
Linking ARM test_rom.elf
make[1]: o: Command not found
make[1]: [test_rom.elf] Error 127 (ignored)
make[1]: Leaving directory `/c/Imperas/Demo/main/isolated_model_ert_rtw
I am also pasting the makefile rules:
all:$(OBJ) test_rom.elf
ert_main.o: ert_main.c isolated_model.h rtwtypes.h
gcc -c ert_main.c
isolated_model.o: isolated_model.c isolated_model.h isolated_model_private.h
gcc -c isolated_model.c
isolated_model_date.o: isolated_model_data.c isolated_model.h isolated_model_data.h
gcc -c isolated_model_data.c
rt_look2d_normal.o: rt_look2d_normal.c rtlibsrc.h
gcc -c rt_look2d_normal.c
rt_nonfinite.o: rt_nonfinite.c rt_nonfinite.h
gcc -c rt_nonfinite.c
rt_look.o: rt_look.c rtlibsrc.h
gcc -c rt_look.c
syscalls.o: syscalls.c
gcc -c syscalls.c
test_rom.elf: $(OBJ)
$(V) echo "Linking $(CROSS) $@"
$(V) $(IMPERAS_LINK) -o $@ $^ $(IMPERAS_LDFLAGS) -lm
clean::
-rm -f test_rom.elf
-rm -f *.$(OBJ).o
endif
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
V
和IMPERAS_LINK
变量未设置,或者设置为空值,因此在构建test_rom.elf
时,make
code> 运行尝试运行
o
命令的 。由于命令中的第一个字符是-
,因此make
会忽略该错误。尝试将
"Linking $(CROSS)"
替换为"Linking $(CROSS) with $(IMPERAS_LINK)"
看看是否是这种情况。The
V
andIMPERAS_LINK
variables are not set, or set to an empty value, so when buildingtest_rom.elf
,make
runs the commandwhich attempts to run the
o
command. Since the first character in the command is-
,make
ignores the error.Try replacing
"Linking $(CROSS)"
with"Linking $(CROSS) with $(IMPERAS_LINK)"
to see if this is the case.