Problem mir "PrintInt(PollSwitch())"

Thema: Problem mir "PrintInt(PollSwitch())"

  1. Rob.Anfänger:

    Problem mir "PrintInt(PollSwitch())"

    Hallo,
    Das folgende Program müsste eigentlich den Tastenwert am Computer ausgeben, aber jedesmal kommt beim Compilieren eine Fehlermeldung:

    Programm:

    Code: [Ansicht]
    #include "asuro.h"
    
    int main(void)
    {
    	Init();
    	
    	while(1)
    	{
    		PrintInt(PollSwitch());
    	}
    	
    	return 0;
    }
    Fehlermeldung:

    Code: [Ansicht]
    C:\Dokumente und Einstellungen\Lieret\Desktop\Kilian\ASURO\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=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 (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:8: warning: implicit declaration of function `PrintInt' 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+0xe): In function `main':
    C:\Dokumente und Einstellungen\Lieret\Desktop\Kilian\ASURO\FirstTry/test.c:8: undefined reference to `PrintInt'make: *** [test.elf] Error 1
    > Process Exit Code: 2
    Was habe ich falsch gemacht?
    ----
     
  2. Avatar von damaltor

    damaltor:
    benutzt du die neue lib? in doer originalen lib gibt es die funktion PrintInt noch nicht
    Read... or die.
    ff.mud.de:7600
    Bild  
     
  3. Rob.Anfänger:
    Danke für deine Antwort.

    Kann sein, dass ich noch die alte ab. Ich benutze die Bibliothek, die auf der CD drauf war. Wo bekommt man die neue her?

    Edit: Habe sie schon gefunden. Ich schau dann mal obs geht.
    ----
     
  4. Sulo:
    Hi

    so solte es auch ohne neue lib gehen
    Code: [Ansicht]
    #include "asuro.h"
    int main(void)
    {
    	char ergebnis[10];
    	int a;
        Init();
        while(1)
        {
            a=PollSwitch();
    		if(a>0)
    		{
    			itoa(a,ergebnis,10);
    			SerWrite(ergebnis,strlen(ergebnis));
    			SerWrite("\n\r",2);
    		}
    		else
    		{
    		}
    	}
        return 0;
    }
     
  5. Avatar von damaltor

    damaltor:
    der else zweig muss nicht hingeschreiben werden, wenn er nicht gebraucht wird. aber an sich hast du recht, was anderes macht die funktion PrintInt auch bloss nicht.
    Read... or die.
    ff.mud.de:7600
    Bild  
     
  6. Sulo:
    Hi damaltor

    du hast recht

    aber ich finde es ist so übersichtlicher.

    Bild