PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : NIBObee: motpid.h einbinden erzeugt Fehler



hanno72
22.01.2011, 19:51
Hallo, liebe Lötwillige,
ich habe die aktuelle nibobeelib 1.3 installiert, und will folgenden Fünfzeiler builden:



#include <nibobee/motpid.h>
int main()
{
motpid_init();
motpid_setSpeed(50,50);
return 0;
}

Aber ich erhalte folgende Fehlermeldungen:



Build started 22.1.2011 at 20:33:15
avr-gcc -I"C:\Users\hanno72\Documents\AVRStudioProjects\del-bee-3\..\..\..\..\..\Program Files (x86)\NIBObeeLib\include" -mmcu=atmega16 -Wall -gdwarf-2 -std=gnu99 -D_NIBOBEE_ -DF_CPU=15000000UL -Os -funsigned-char -funsigned-bitfields -fpack-st
ruct -fshort-enums -MD -MP -MT del-bee-3.o -MF dep/del-bee-3.o.d -c ../del-bee-3.c

In file included from ../del-bee-3.c:1:
C:\Users\hanno72\Documents\AVRStudioProjects\del-bee-3\..\..\..\..\..\Program Files (x86)\NIBObeeLib\include/nibobee/motpid.h:66: error: expected ')' before 'immediate'
C:\Users\hanno72\Documents\AVRStudioProjects\del-bee-3\..\..\..\..\..\Program Files (x86)\NIBObeeLib\include/nibobee/motpid.h:76: error: expected ')' before 'left'
C:\Users\hanno72\Documents\AVRStudioProjects\del-bee-3\..\..\..\..\..\Program Files (x86)\NIBObeeLib\include/nibobee/motpid.h:86: error: expected ')' before 'left'
C:\Users\hanno72\Documents\AVRStudioProjects\del-bee-3\..\..\..\..\..\Program Files (x86)\NIBObeeLib\include/nibobee/motpid.h:96: error: expected ')' before 'left'
../del-bee-3.c: In function 'main':
../del-bee-3.c:5: warning: implicit declaration of function 'motpid_setSpeed'
make: *** [del-bee-3.o] Error 1
Build failed with 4 errors and 1 warnings...


Die vier betreffenden Zeilen in motpid.h sind:


void motpid_stop(uint8_t immediate);
void motpid_setSpeed(int16_t left, int16_t right);
void motpid_setTarget(int16_t left, int16_t right, uint16_t speed);
void motpid_setTargetRel(int16_t left, int16_t right, uint16_t speed);


Kann mir jemand sagen, was ich falsch mache?
Vielen Dank für eine Antwort.

Gruß
Hanno

workwind
25.01.2011, 18:17
Hallo hanno72,

Du hast folgende Zeile als erste Zeile der includes vergessen:


#include <nibo/niboconfig.h>

aurikeL
05.02.2011, 20:58
Funktioniert bei mir, trotz

#include <nibobee/iodefs.h>
nicht.
Ich bekomme die gleichen Fehler, wie der Threadersteller:

C:\Program Files (x86)\NIBObeeLib\include/nibobee/motpid.h:44: error: expected ';', ',' or ')' before numeric constant
C:\Program Files (x86)\NIBObeeLib\include/nibobee/motpid.h:54: error: expected ';', ',' or ')' before numeric constant
C:\Program Files (x86)\NIBObeeLib\include/nibobee/motpid.h:64: error: expected ';', ',' or ')' before numeric constant

TobiKa
05.02.2011, 21:26
Ist die
#include <stdint.h>
eingebunden?

aurikeL
05.02.2011, 21:31
Ist die
#include <stdint.h>
eingebunden?

Damit taucht der Fehler weiterhin auf, die betroffenen Stellen (in der Headerdatei) sind folgende:

1:
void motpid_setSpeed(int16_t left, int16_t right);
2:
void motpid_setTarget(int16_t left, int16_t right, uint16_t speed);
3:
void motpid_setTargetRel(int16_t left, int16_t right, uint16_t speed);

TobiKa
05.02.2011, 21:33
Zeig mal die ganze Datei

aurikeL
05.02.2011, 21:50
Zeig mal die ganze Datei

Headerdatei (ohne Kommentare usw.):


#ifndef _NIBOBEE_MOTPID_H_
#define _NIBOBEE_MOTPID_H_

#ifdef __cplusplus
extern "C" {
#endif

void motpid_init();

void motpid_release();

void motpid_stop(uint8_t immediate);

void motpid_setSpeed(int16_t left, int16_t right);

void motpid_setTarget(int16_t left, int16_t right, uint16_t speed);

void motpid_setTargetRel(int16_t left, int16_t right, uint16_t speed);


#ifdef __cplusplus
} // extern "C"
#endif

#endif // _NIBOBEE_MOTPID_H_

Ich mach den PC mal aus und schau mir das morgen nochmal an - ggf. versuch ich die Realisierung ohne motpid.
(Ich hab gerade nochmal ein neues Projekt erstellt, da kam die Fehlermeldung "undefined reference to 'motpid_init()' - vielleicht bin ich gerade aber auch nur ein wenig müde ;) )

TobiKa
05.02.2011, 21:52
Hehe, ja das hilft manchmal.
Irgendetwas fehlt ihm. Aber ohen das selbst hier zu haben, ist es grad schlecht nachzuvollziehen.

radbruch
05.02.2011, 22:10
Hallo

Nur mal ein Schuß ins Blaue:

Im Startbeitrag wird folgende Fehlermeldung gezeigt:


....Program Files (x86)\NIBObeeLib\include/nibobee/motpid.h:66: error: expected ')' before 'immediate'

Die betreffende Zeile ist wohl:

void motpid_stop(uint8_t immediate);

Mein Tipp: Der Kompiller erkennt uint8_t nicht als Datentyp und interpretiert es als Variablenname. Dann müsste anstatt "immediate" eine Klammer folgen. Abhilfe wäre dann vielleicht ein

#include <inttypes.h>

im Kopf von motpid.h.

Plan B wäre ein Blick in die Datei motpid.c auf die Zeile 66, denn diese Zeile gibt es nicht in motpid.h! Vielleicht stimmen die Definitionen der Parameter in den Funktionen in motpid.h und motpid.c nicht überein.

Oder 3.: motpid.c ist nicht eingebunden.

Gruß

mic

klsc
06.03.2012, 22:48
Hallo zusammen,
ich habe eben versucht das Beispielprogramm vom bgx1 am NIBObee auszuprobieren und etwas abzuändern. Leider läuft bei mir der Kompiliervorgang auch nicht durch und bricht ab mit
undefined reference to `motpid_init'
wie im Beitrag von aurikeL. Leider hat weder das Einfügen von inittypes etwas gebracht, noch ein anderer Vorschlag. Habt ihr es nun hinbekommen?

vielen Dank,
KS