avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Compiler linking error


From: E. Weddington
Subject: Re: [avr-gcc-list] Compiler linking error
Date: Fri, 27 Feb 2004 15:43:43 -0700

On 27 Feb 2004 at 14:18, Nick Brent wrote:

> Hey everyone. I checked the archives, but I didn't see an answer to this exact
> question. I'm using avr-gcc 3.3.1. What I'm trying to do is create a static
> library that I can distribute to others. When I use this command to compile 
> the
> project:
> 
>     avr-gcc -mmcu=atmega128 delay2.o lcdcntrl.o test2.c -o test2.ex
> 
> It compiles just fine. The problem I run into is that when I compile a project
> with a static library using these commands:
> 
>     avr-ar -r libtest2.a delay2.o lcdcntrl.o
>     avr-gcc -mmcu=atmega128 libtest2.a test2.c -o test2.ex
> 
> Then I get this error message:
> 
>     C:\WINDOWS\TEMP/ccULbaaa.o(.text+0xce): In function `main':
>     : undefined reference to `lcd_init'
>     C:\WINDOWS\TEMP/ccULbaaa.o(.text+0xe2): In function `main':
>     : undefined reference to `line1'
> 
> The functions 'lcd_init' and 'line1' are contained in the lcdcntrl.o file. I
> kept playing around with it, and I found out that when I used the canned
> makefile in winavr\sample\makefile and insert the line 'LDFLAGS += libtest2.a'
> into the section labeled '# Additional libraries' the program compiles just
> fine. I'm assuming there is some command line argument that avr-gcc needs that
> the regular gcc compile doesn't, but what is it? Any and all help is
> appreciated.
> 

avr-gcc -mmcu=atmega128 test2.c -o test2.ex -ltest2

Note:
1. -l flag (lowercase L). See GCC user manual.
2. Position of library, generally after the other objects. Again see GCC user 
manual.


_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list


reply via email to

[Prev in Thread] Current Thread [Next in Thread]