簡體   English   中英

STM32CubeIDE中的多個定義錯誤?

[英]Multiple definitions error in STM32CubeIDE?

我一直在關注此文檔,以將數碼相機模塊與 stm32f746g-disco 板連接:

鏈接到文檔

我特別關注的部分是 pgs 60-74。

一切都運行良好,直到第 68 頁,在我編譯時完成 68-74 所示的步驟后,我收到以下錯誤:

c:\st\stm32cubeide_1.6.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_2.0.0.202105311346\tools\arm-none-eabi\bin\ld.exe: ./Core/Src/main.o:C:/Users/Garrett/STM32CubeIDE/workspace_1.6.2/DCMI_Project/Debug/../Core/Src/font24.c:85: multiple definition of `Font24_Table'; ./Core/Src/font24.o:C:/Users/Garrett/STM32CubeIDE/workspace_1.6.2/DCMI_Project/Debug/../Core/Src/font24.c:85: first defined here

c:\st\stm32cubeide_1.6.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_2.0.0.202105311346\tools\arm-none-eabi\bin\ld.exe: ./Core/Src/main.o:(.data.Font24+0x0): multiple definition of `Font24'; ./Core/Src/font24.o:(.data.Font24+0x0): first defined here

collect2.exe: error: ld returned 1 exit status
make: *** [makefile:74: DCMI_Project.elf] Error 1
"make -j16 all" terminated with exit code 2. Build might be incomplete.

我不確定這是 linker 錯誤,因為 Font24_Table 和 Font24 在 header 文件中聲明並在 Z4A8A08F09D37B737953649038408B5 文件中定義。

這是 header 中唯一提到的 table 和 font24

這是 c 文件中表格的定義這是 c 文件中 font24 的定義

所以我嘗試調試為 makefile 錯誤,並導航到 makefile。 網上的多個消息來源說,在 C_SRCS 中我可能會看到兩次相同的東西,刪除它會解決我的問題。 但是,我沒有看到任何重復。

我正在看的 makefile

最后,我想我會顯示項目目錄,因為沒有關於項目中錯誤位置的可見指示符。

項目目錄

對不起,如果這個問題真的很密集,我已經解決這個問題一段時間了,但我不是 C 或 stm32CubeIDE 的專家。 我將不勝感激任何幫助/輸入,謝謝!

c:\st\stm32cubeide_1.8.0\stm32cubeide\plugins\xxx\tools\arm-none-eabi\bin\ld.exe: ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.o: in function HAL_UART_Init': C:/xxx/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c:353: multiple definition of ./Core/Src/stm32f1xx_hal_uart.o:C:/xxx/Core/Src/stm32f1xx_hal_uart.c:353:這里首先定義

編譯時出現“'HAL_UART_Init'的多重定義”,

我有這個問題的原因是我確實定義了兩個“HAL_UART_Init”(我不小心復制了一個xxx.c文件)

我認為您的 main.c 和 font24.c 可能都定義了“Font24_Table”function。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM