我已经创建了两个静态库,用于使用一个C程序,我正在为一个ARM STM32F4xx处理器编写一个使用Mentor的程序。我已经将库及其目录添加到项目中的构建设置中,因为我认为它们应该是(在属性下,C/C++ build ->Tool Settings->Sourcery CodeBench C Linker-> libraries ),但是当我编译和链接项目时,我会得到对其中一个库中函数的未定义引用错误。我试着改变图书馆相对于彼此的顺序。我在下面的编译器日志中包含了一个片段,用于清理长路径名。
我在这里完全不知所措,所以任何帮助都是非常感谢的。
'Building target: Firmware_Development'
'Invoking: Sourcery CodeBench C Linker'
arm-none-eabi-gcc -L"Libary1-Folder-Path" -L"Library2-Folder-Path" -Xlinker -Map="Firmware_Development.map" -T "firmware-rom-hosted.ld -mcpu=cortex-m4 -mthumb -o "Firmware_Development" "@objs.rsp" "@user_objs.rsp" "@libs.rsp"
src/main.o: In function `program_loop':
\\Debug/../src/main.c:99: undefined reference to `LwIP_Pkt_Handle'
\\Debug/../src/main.c:103: undefined reference to `LwIP_Periodic_Handle'
src/stm32f4xx_it.o: In function `__cs3_isr_exti15_10':
\\Debug/../src/stm32f4xx_it.c:187: undefined reference to `Eth_Link_ITHandler'
src/Config.o: In function `Communication_Init':
\\Debug/../Libraries_Firmware/src/Config.c:175: undefined reference to `ETH_BSP_Config'
\\Debug/../Libraries_Firmware/src/Config.c:178: undefined reference to `LwIP_Init'
collect2.exe: error: ld returned 1 exit status
cs-make: *** [Firmware_Development] Error 1发布于 2013-12-12 22:28:46
对于那些通过搜索来到这里的人来说,问题就像@ChrisStratton建议的那样。代码最初是作为单个项目创建的,我选择将其中的很大一部分合并到库中。当我这样做时,我分解出一个头文件,但遗漏了它的相应源文件,所以所有的东西都编译得很好,但是链接失败了。检查objdump使这一点变得非常明显,因为对象不存在。
https://stackoverflow.com/questions/20387857
复制相似问题