hmmm...
bei mir ist es in stdlib drin!
welche Version von gcc hast du?
Druckbare Version
hmmm...
bei mir ist es in stdlib drin!
welche Version von gcc hast du?
sry hab gerade was falsches geschrieben ... dtostre ist nicht in stdlib drin...
habe gerade folgendes gefunden:
Zitat:
Note that these functions are not located in the default library, libc.a, but in the
mathematical library, libm.a. So when linking the application, the -lm option needs
to be specified.
Das hatten wir irgendwann schonmal aber es wurde glaube ich nicht geklärt wo dieses "-lm" hin muss. Um ehrlich zu sein: Ich habe keine Ahnung was "linken" überhaupt ist.
mfg
jagdfalke
versuch einmal in deinem Makefile an die folgende Zeile " -lm" anhängen:
CFLAGS=-g -mmcu=$(MCU) -Wall -Wstrict-prototypes -Os -mcall-prologues
zu der Frage was Linken überhaupt ist:
http://de.wikipedia.org/wiki/Linker_%28Programm%29
immernoch das hier:
werd mir das mal durchlesen im wiki.Zitat:
inux:/home/mathias/makefile und load/roboterarm steuerung # make
avr-gcc -g -mmcu=atmega32 -Wall -Wstrict-prototypes -Os -mcall-prologues -lm -Os -c test.c
test.c:42:2: warning: no newline at end of file
avr-gcc: -lm: linker input file unused because linking not done
avr-gcc -g -mmcu=atmega32 -Wall -Wstrict-prototypes -Os -mcall-prologues -lm -o test.out -Wl,-Map,test.map test.o
test.o: In function `main':
/home/mathias/makefile und load/roboterarm steuerung/test.c:21: undefined reference to `dtostrf'
make: *** [test.out] Fehler 1
thx
jagdfalke
Funktionierts wenn du das -lm an die folgende Zeile anhängst??
Zitat:
$(CC) $(CFLAGS) -Os -c test.c
nee, aber wenigstens hat sich die Fehlermeldung schon mal geändert:
Zitat:
linux:/home/mathias/makefile und load/roboterarm steuerung # make
avr-gcc -g -mmcu=atmega32 -Wall -Wstrict-prototypes -Os -mcall-prologues -lm -Os -c test.c -lm
test.c:42:2: warning: no newline at end of file
avr-gcc: -lm: linker input file unused because linking not done
avr-gcc: -lm: linker input file unused because linking not done
avr-gcc -g -mmcu=atmega32 -Wall -Wstrict-prototypes -Os -mcall-prologues -lm -o test.out -Wl,-Map,test.map test.o
test.o: In function `main':
/home/mathias/makefile und load/roboterarm steuerung/test.c:21: undefined reference to `dtostrf'
make: *** [test.out] Fehler 1
nee hatse eigentlich nicht. liegt daran, dass ich das andere lm nicht entfernt hab :D
Dann müsste es hoffendlich so funktionieren, wenn du "-lm" an die Zeile
anhängst und die andern -lm die du vorher angehängt hast wieder entfernst ...Zitat:
$(CC) $(CFLAGS) -o test.out -Wl,-Map,test.map test.o
also mit diesem makefile:
kommt diese Fehlermeldung:Code:# makefile, written by guido socher
MCU=atmega32
CC=avr-gcc
OBJCOPY=avr-objcopy
# optimize for size:
CFLAGS=-g -mmcu=$(MCU) -Wall -Wstrict-prototypes -Os -mcall-prologues
#-------------------
all: test.hex
#-------------------
help:
@echo "Usage: make all|load|load_pre|rdfuses|wrfuse1mhz|wrfuse4mhz|wrfusecrystal"
@echo "Warning: you will not be able to undo wrfusecrystal unless you connect an"
@echo " external crystal! uC is dead after wrfusecrystal if you do not"
@echo " have an external crystal."
#-------------------
test.hex : test.out
$(OBJCOPY) -R .eeprom -O ihex test.out test.hex
test.out : test.o
$(CC) $(CFLAGS) -o test.out -Wl,-Map,test.map test.o
test.o : test.c
$(CC) $(CFLAGS) -Os -c test.c -lm
#------------------
load: test.hex
./prg_load_uc test.hex
# here is a pre-compiled version in case you have trouble with
# your development environment
load_pre: test_pre.hex
./prg_load_uc test.hex
#
loaduisp: test.hex
./prg_load_uc -u test.hex
# here is a pre-compiled version in case you have trouble with
# your development environment
load_preuisp: test_pre.hex
./prg_load_uc -u test.hex
#-------------------
# fuse byte settings:
# Atmel AVR ATmega8
# Fuse Low Byte = 0xe1 (1MHz internal), 0xe3 (4MHz internal), 0xe4 (8MHz internal)
# Fuse High Byte = 0xd9
# Factory default is 0xe1 for low byte and 0xd9 for high byte
# Check this with make rdfuses
rdfuses:
./prg_fusebit_uc -r
# use internal RC oscillator 1 Mhz
wrfuse1mhz:
./prg_fusebit_uc -w 1
# use internal RC oscillator 4 Mhz
wrfuse4mhz:
./prg_fusebit_uc -w 4
# use external 3-8 Mhz crystal
# Warning: you can not reset this to intenal unless you connect a crystal!!
wrfusecrystal:
@echo "Warning: The external crystal setting can not be changed back without a working crystal"
@echo " You have 3 seconds to abort this with crtl-c"
@sleep 3
./prg_fusebit_uc -w 0
#-------------------
clean:
rm -f *.o *.map *.out *t.hex
#-------------------
es hat sich also nichts geändert, egal wo ich "-lm" hinzufüge oder weglasse :(Zitat:
linux:/home/mathias/makefile und load/roboterarm steuerung # make
avr-gcc -g -mmcu=atmega32 -Wall -Wstrict-prototypes -Os -mcall-prologues -o test.out -Wl,-Map,test.map test.o
test.o: In function `main':
/home/mathias/makefile und load/roboterarm steuerung/test.c:21: undefined reference to `dtostrf'
make: *** [test.out] Fehler 1
mfg
jagdfalke