From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9343 invoked by alias); 31 Aug 2012 11:51:31 -0000 Received: (qmail 9332 invoked by uid 22791); 31 Aug 2012 11:51:30 -0000 X-SWARE-Spam-Status: No, hits=0.4 required=5.0 tests=AWL,BAYES_00,TW_LG,URI_HEX X-Spam-Check-By: sourceware.org Received: from sam.nabble.com (HELO sam.nabble.com) (216.139.236.26) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 31 Aug 2012 11:51:15 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1T7Pko-0003rK-HA for gcc-help@gcc.gnu.org; Fri, 31 Aug 2012 04:51:14 -0700 Date: Fri, 31 Aug 2012 19:24:00 -0000 From: HvW To: gcc-help@gcc.gnu.org Message-ID: <1346413874515-865274.post@n5.nabble.com> Subject: Building library with extern data fails in GCC MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2012-08/txt/msg00301.txt.bz2 Hi, I am trying to create a library that handles the USART TX and RX data. The buffer used for the TX and RX data I declared as extern as this needs to be specified by the application using the library. This works fine in Keil ARM-MDK. Attempting to build this in the latest version of GCC shows the following errors: C:\yagarto_cortex_m3\bin\arm-none-eabi-gcc libhl_usart.o -mcpu=cortex-m3 -mthumb -nostartfiles -Tstm32f103x_xl_flash.ld -Wl,-Map=lib_usart.map,--cref,--no-warn-mismatch -L./lib/ -lm -lgcc -lc ./lib/lib_stm3210x_xl_stdperiph.a -o lib_usart.elf libhl_usart.o: In function `Libhl_Usart_Lib_Init': libhl_usart.c:(.text+0x1a): undefined reference to `Libhl_Usart2_Tx_Buff' libhl_usart.c:(.text+0x1e): undefined reference to `Libhl_Usart2_Tx_Buff' libhl_usart.c:(.text+0x2c): undefined reference to `Libhl_Usart3_Tx_Buff' libhl_usart.c:(.text+0x30): undefined reference to `Libhl_Usart3_Tx_Buff' libhl_usart.c:(.text+0x3e): undefined reference to `Libhl_Uart4_Tx_Buff' libhl_usart.c:(.text+0x42): undefined reference to `Libhl_Uart4_Tx_Buff' libhl_usart.c:(.text+0x50): undefined reference to `Libhl_Uart5_Tx_Buff' libhl_usart.c:(.text+0x54): undefined reference to `Libhl_Uart5_Tx_Buff' libhl_usart.c:(.text+0x62): undefined reference to `Libhl_Usart1_Rx_Buff' libhl_usart.c:(.text+0x66): undefined reference to I am sure that I am just missing some compiler option that will allow it to assume that the data will be available when needed. I am attaching the code and makefile. http://gcc.1065356.n5.nabble.com/file/n865274/code_makefile.rar code_makefile.rar Please help me solve this problem. Thanks, -- View this message in context: http://gcc.1065356.n5.nabble.com/Building-library-with-extern-data-fails-in-GCC-tp865274.html Sent from the gcc - Help mailing list archive at Nabble.com.