Jar*_*red 5 c gcc arm stm32 codesourcery
我创建了两个静态库,用于我正在使用Mentor Graphics CodeSourcery为ARM STM32F4xx处理器编写的C程序.我已将库及其目录添加到项目中的构建设置中,因为我认为它们应该是(在属性,C/C++构建 - >设置 - >工具设置 - >源代码CodeBench C链接器 - >库)但是当我编译并链接项目,我得到一个库中的函数未定义的引用错误.我试过改变库相对于彼此的顺序.我在编辑的日志中包含了一个片段,以清理长路径名.
我在这里完全失去了所以任何帮助表示赞赏.
'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
Run Code Online (Sandbox Code Playgroud)
对于那些通过搜索来到这里的人来说,问题正如@ChrisStratton 所建议的那样。该代码最初是作为单个项目创建的,我选择将其中的很大一部分提取到一个库中。当我这样做时,我提取了一个头文件,但错过了其相应的源文件,因此一切都编译正常,但链接失败。检查 objdump 使这一点非常明显,因为对象不存在。