新聞中心

        EEPW首頁 > 嵌入式系統 > 設計應用 > LPC2132學習中遇到的錯誤1

        LPC2132學習中遇到的錯誤1

        作者: 時間:2016-11-23 來源:網絡 收藏
        自己寫了一個頭文件LCD.H,在其中定義了如下的全局變量
        const int8 NoCheckBusy = 0;
        const int8 CheckBusy = 1;
        const int32 LCD_RS = 1<<4;
        const int32 LCD_RW = 1<<5;
        const int32 LCD_EN = 1<<6;
        const int32 LCD_DATA = 0xff<<7;
        在c文件lcd.c和main.c中都要用到,但是在編譯的時候出現如下的問題:
        Error: L6200E: Symbol NoCheckBusy multiply defined (by main.o and lcd.o).
        Error: L6200E: Symbol LCD_RS multiply defined (by main.o and lcd.o).
        上網站arm.com/help/index.jsp?topic=/com.arm.doc.dui0435a/index.html" target="_blank">http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0435a/index.html上去查找,有如下結果:

        L6200E:Symbol multiply defined (by and ).
        There are two common examples where this occurs:
        1)Symbol __semihosting_swi_guard multiply defined (by use_semi.o and use_no_semi.o).
        This error is reported when functions that use semihosting SWIs are linked in from the C library, in the presence of the__use_no_semihosting_swiguard. See the ADS 1.2 Compilers and Libraries Guide, section 4.2.2, "Building an application for a nonsemihosted environment" and ADS 1.2 Developer Guide, Section 6.10.1, "Linker error __semihosting_swi_guard".
        To resolve this, you must provide your own implementations of these C library functions.
        The ADS 1.2 Examplesembedded directory contains examples of how to re-implement some of the more common SWI-using functions - see the fileretarget.c.
        To identify which SWI-using functions are being linked-in from the C libraries:
        1. Link with armlink -verbose -errors err.txt
        2. Search err.txt for occurrences of __I_use_semihosting_swi
        For example:
        :
        Loading member sys_exit.o from c_a__un.l.
        reference : __I_use_semihosting_swi
        definition: _sys_exit
        :
        This shows that the SWI-using function _sys_exit is being linked-in from the C library. To prevent this, you will need to provide your own implementation of this function.
        2)Symbol __stdout multiply defined (by retarget.o and stdio.o).
        This means that there are two conflicting definitions of__stdoutpresent – one inretarget.o, the other instdio.o. The one inretarget.ois your own definition. The one instdio.ois the default implementation, which was probably linked-in inadvertently.
        stdio.ocontains a number symbol definitions and implementations of file functions likefopen,fclose,fflush, etc.stdio.ois being linked-in because it satisfies some unresolved references.
        To identify why stdio.o is being linked-in, you must link with the linkers "verbose" switch, e.g.:
        armlink [... your normal options...] -verbose -errors err.txt
        Then studyerr.txt, so see exactly what the linker is linking-in, from where, and why.
        To move forward, the user may have to either:
        - Eliminate the calls likefopen,fclose,fflush, etc, or
        - Re-implement the_sys_xxxxfamily of functions.
        See the ADS 1.2 Compilers and Libraries Guide, section 4.10, "Tailoring the input/output functions".
        具體是什么意思看的也不是很懂,后來看了別人的解決方法是:在頭文件中僅聲明變量,而把變量的定義都放到c文件中去,問題就解決了。
        即把

        const int8 NoCheckBusy = 0;
        const int8 CheckBusy = 1;
        const int32 LCD_RS = 1<<4;
        const int32 LCD_RW = 1<<5;
        const int32 LCD_EN = 1<<6;
        const int32 LCD_DATA = 0xff<<7;

        都放到lcd.c中就可避免該問題,時間不多,具體原因還有待研究。



        關鍵詞: LPC213

        評論


        技術專區

        關閉
        主站蜘蛛池模板: 大英县| 东莞市| 平安县| 彭阳县| 营山县| 丹东市| 丹巴县| 永寿县| 信阳市| 上饶县| 阳东县| 垦利县| 龙南县| 黑河市| 汝南县| 抚松县| 宿州市| 凤山市| 江北区| 常山县| 宣武区| 汉寿县| 正定县| 汉中市| 赣州市| 九寨沟县| 云浮市| 阿克苏市| 民县| 麻江县| 本溪| 桑植县| 绵竹市| 兴海县| 伊金霍洛旗| 遵义县| 巴塘县| 呈贡县| 罗江县| 囊谦县| 临猗县|