[En-Nut-Discussion] freopen: undefined reference

Arjan Vroegop atjev at hotmail.com
Tue Mar 29 19:08:42 CEST 2005


Hi!

I'm trying to control a LCD with a Ethernut 1.3g board. I tried the 
following code, which comes from the ethernut software manual:

#include <stdio.h>
#include <dev/hd44780.h>
#include <dev/term.h>
int main(void)
{
/* Register the device we want to use. */
NutRegisterDevice(&devLcd, 0, 0);
/* Assign the device to stdout. */
freopen("lcd", "w", stdout);
printf("Hello world!\n");
}

When I compile the program with avrgcc I get the following error:

make install
avr-gcc main.o -mmcu=atmega128 -Wl,--defsym=main=0,-Map=main.map,--cref 
-Lc:/eth
ernut/build/lib  c:/ethernut/build/lib/nutinit.o -lnutos -lnutdev  -o 
main.elf
main.o(.text+0x1e): In function `NutAppMain':
: undefined reference to `freopen'
make: *** [main.elf] Error 1

I think it's a problem with the linking. I tried to find information about 
this problem on the internet, I saw something about the .map file. This file 
contains the following line:

freopen                                           main.o

I assume this means that the linker looks for freopen in main.o, which 
obviously isn't there. Is there anybody who know how to fix this?

Thanks in advance,
Arjan Vroegop

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/




More information about the En-Nut-Discussion mailing list