PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Probleme beim Compilieren



ActiveRobo
28.07.2012, 11:45
Hallo,

Leider habe ich mal wieder ein Problem. Ich habe in der AsuroWiki das Beispielprogramm: "Kollisiontest mit den Tastsensoren" ausprobieren wollen doch beim compilieren schreibt er folgendes hin:

C:\Asuro\ASURO_src\FirstTry>make all
set -e; avr-gcc -MM -mmcu=atmega8 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=asuro.lst asuro.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > asuro.d; \
[ -s asuro.d ] || rm -f asuro.d
C:\Users\Michael\AppData\Local\Temp\make384562.sh: /c/WinAVR/bin/avr-gcc: Invalid argument
set -e; avr-gcc -MM -mmcu=atmega8 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=test.lst test.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > test.d; \
[ -s test.d ] || rm -f test.d
C:\Users\Michael\AppData\Local\Temp\make384563.sh: /c/WinAVR/bin/avr-gcc: Invalid argument
-------- begin --------
avr-gcc --version
avr-gcc (GCC) 3.3.1
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

avr-gcc -c -mmcu=atmega8 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=test.lst test.c -o test.o
test.c: In function `main':
test.c:73: warning: implicit declaration of function `Msleep'
avr-gcc -c -mmcu=atmega8 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=asuro.lst asuro.c -o asuro.o
avr-gcc -mmcu=atmega8 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=test.o test.o asuro.o --output test.elf -Wl,-Map=test.map,--cref -lm
test.o(.text+0xa4): In function `main':
C:\Asuro\ASURO_src\FirstTry/test.c:73: undefined reference to `Msleep'
make: *** [test.elf] Error 1

> Process Exit Code: 2


Da ich noch sehr unerfahren in der Welt des Programmierens bin, würde ich mich freuen wenn ihr mir dabei helfen könntet. Ich arbeite mit dem Programmers Notepad und mein Compilierer ist der AVR Insight. Ich bin mir nicht sicher ob der Compiler richtig ist.

ActiveRobo
30.07.2012, 10:15
Hey Leute,

Ihr würdet mir echt helfen wenn ihr mir antwortet. Und ich hätte noch eine Frage. Ich soll als Aufgabe ein Programm schreiben, dass meinen Asuro geradeaus fahren lässt und wenn er dann auf eine schware Linie trifft, dann soll er stehen bleiben und blinken. Nur im Moment weiß ich nicht wie ich das anstellen soll. Ich bin wirklich ein Anfänger auf dem Gebiet der Programmierung. Also währe es echt nett von euch wenn ihr mir helfen könntet.

sero_77
30.07.2012, 11:48
Hallo ActiveRobo,

na dann wollen wir mal Dein Problem angehen.
In dem Compiler- Output stehen mehrere Fehler, die wir erst mal beheben müssen.

"test.c:73: warning: implicit declaration of function `Msleep'"
bedeutet, dass Du die Funktion "Msleep" benutzt, bevor sie deklariert wurde.



Kannst Du den Code (test.c) hier mal posten, oder mir per PN zukommen lassen, dann schaue ich Ihn mal durch.

Deine zweite Frage gehen wir dann an, wenn Du Deinen aktuellen Code ohne Fehler compilieren kannst.

Viele Grüße
Stefan

radbruch
30.07.2012, 12:59
Hallo

Zu: "test.c:73: warning: implicit declaration of function `Msleep'" siehe https://www.roboternetz.de/community/threads/32516-Falsche-Tastererkennung?p=555474&viewfull=1#post555474

zu: "C:\Users\Michael\AppData\Local\Temp\make384563.sh: /c/WinAVR/bin/avr-gcc: Invalid argument" ist schon kniffeliger. Wer bekommt das "Invalid argument"?

In der Komandozeile eingegeben erhält man dies:


D:\mic\KamAVR\asuro>set -e; avr-gcc -MM -mmcu=atmega8 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=test.lst test.c | sed ',\(.*\)\.o[ :]*,\1.o\1.d : ,g' > test.d; [ -s test.d ] || rm -f test.d
sed: invalid option -- s
Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]...

-n, --quiet, --silent
suppress automatic printing of pattern space
-e script, --expression=script
add the script to the commands to be executed
-f script-file, --file=script-file
add the contents of script-file to the commands to be executed
-c --nocr turn off \r$ translation; must be first switch on command line
--help display this help and exit
-V, --version output version information and exit

If no -e, --expression, -f, or --file option is given, then the first
non-option argument is taken as the sed script to interpret. All
remaining arguments are names of input files; if no input files are
specified, then the standard input is read.

E-mail bug reports to: bug-gnu-utils@gnu.org .
Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.Blau ist die Eingabezeile aus dem Makefile (im Orginal ist sie mit \ auf mehrere Zeilen verteilt), rot die Fehlermeldung. Der Befehl "sed" steckt in der Eingabe hinter dem | (Pipe). Aber bevor wir da lange rumsuchen, mit dem orginalen firsttry-makefile und allen Dateien in einem Verzeichniss funktioniert es bei mir:


D:\mic\KamAVR\asuro>dir
Datenträger in Laufwerk D: ist Files
Volumeseriennummer: FC70-2BAE

Verzeichnis von D:\mic\KamAVR\asuro

30.07.2012 13:44 <DIR> .
30.07.2012 13:44 <DIR> ..
19.12.2005 12:38 7.680 asuro.c
30.07.2012 12:33 4.876 asuro.h
30.07.2012 13:44 <DIR> lib
19.12.2005 16:15 7.297 makefile
30.07.2012 12:32 79 test.c
4 Datei(en), 19.932 Bytes
3 Verzeichnis(se), 841.583.415.296 Bytes frei

D:\mic\KamAVR\asuro>make all
set -e; avr-gcc -MM -mmcu=atmega8 -I. -g -Os -I../../lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=asuro.lst asuro.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > asuro.d; \
[ -s asuro.d ] || rm -f asuro.d
set -e; avr-gcc -MM -mmcu=atmega8 -I. -g -Os -I../../lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=test.lst test.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > test.d; \
[ -s test.d ] || rm -f test.d
-------- begin --------
avr-gcc --version
avr-gcc (WinAVR 20100110) 4.3.3
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

avr-gcc -c -mmcu=atmega8 -I. -g -Os -I../../lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=test.lst test.c -o test.o
avr-gcc -c -mmcu=atmega8 -I. -g -Os -I../../lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=asuro.lst asuro.c -o asuro.o
avr-gcc -mmcu=atmega8 -I. -g -Os -I../../lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=test.o test.o asuro.o --output test.elf -Wl,-Map=test.map,--cref -lm
avr-objcopy -O ihex -R .eeprom test.elf test.hex
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 -O ihex test.elf test.eep
d:\WinAVR-20100110\bin\avr-objcopy.exe: --change-section-lma .eeprom=0x00000000 never used
avr-objdump -h -S test.elf > test.lss
Size after:
test.elf :
section size addr
.text 1692 0
.bss 1 8388704
.debug_aranges 64 0
.debug_pubnames 263 0
.debug_info 1060 0
.debug_abbrev 401 0
.debug_line 1120 0
.debug_frame 288 0
.debug_str 358 0
.debug_loc 388 0
Total 5635


Errors: none
-------- end --------

D:\mic\KamAVR\asuro>dir
Datenträger in Laufwerk D: ist Files
Volumeseriennummer: FC70-2BAE

Verzeichnis von D:\mic\KamAVR\asuro

30.07.2012 13:45 <DIR> .
30.07.2012 13:45 <DIR> ..
19.12.2005 12:38 7.680 asuro.c
30.07.2012 13:45 34 asuro.d
30.07.2012 12:33 4.876 asuro.h
30.07.2012 13:45 97.555 asuro.lst
30.07.2012 13:45 9.840 asuro.o
30.07.2012 13:44 <DIR> lib
19.12.2005 16:15 7.297 makefile
30.07.2012 12:32 79 test.c
30.07.2012 13:45 31 test.d
30.07.2012 13:45 13 test.eep
30.07.2012 13:45 9.131 test.elf
30.07.2012 13:45 4.775 test.hex
30.07.2012 13:45 43.485 test.lss
30.07.2012 13:45 11.353 test.lst
30.07.2012 13:45 35.440 test.map
30.07.2012 13:45 2.260 test.o
15 Datei(en), 233.849 Bytes
3 Verzeichnis(se), 841.583.185.920 Bytes frei

Gruß

mic

ActiveRobo
30.07.2012, 13:17
Den Code kannst du dir unter diesem Link anschauen: http://www.asurowiki.de/pmwiki/pmwiki.php/Main/KollisionsTestC